1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-10 15:52:27 +08:00

refactor: add function comment for tag.go

This commit is contained in:
dudaodong
2023-03-15 17:43:47 +08:00
parent f79693804b
commit 7261b281ad
4 changed files with 14 additions and 4 deletions

View File

@@ -1,10 +1,12 @@
package structutil
import (
"github.com/duke-git/lancet/v2/validator"
"strings"
"github.com/duke-git/lancet/v2/validator"
)
// Tag is abstract struct field tag
type Tag struct {
Name string
Options []string
@@ -18,6 +20,7 @@ func newTag(tag string) *Tag {
}
}
// HasOption check if a struct field tag has option setting.
func (t *Tag) HasOption(opt string) bool {
for _, o := range t.Options {
if o == opt {
@@ -27,6 +30,7 @@ func (t *Tag) HasOption(opt string) bool {
return false
}
// IsEmpty check if a struct field has tag setting.
func (t *Tag) IsEmpty() bool {
return validator.IsEmptyString(t.Name)
}