chore: structure support ignore tag

This commit is contained in:
wwqgtxx
2025-11-03 14:57:23 +08:00
parent c25a38898f
commit 27b47f976c
2 changed files with 26 additions and 0 deletions

View File

@@ -53,6 +53,12 @@ func (d *Decoder) Decode(src map[string]any, dst any) error {
key, omitKey, found := strings.Cut(tag, ",")
omitempty := found && omitKey == "omitempty"
// As a special case, if the field tag is "-", the field is always omitted.
// Note that a field with name "-" can still be generated using the tag "-,".
if key == "-" {
continue
}
value, ok := src[key]
if !ok {
if d.option.KeyReplacer != nil {