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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user