tagutil

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FormatFieldTag

type FormatFieldTag struct {
	Name          string
	HasNameOrCase bool
	OmitEmpty     bool
	Ignore        bool
	Inline        bool
	Nullable      bool
	TimeLayout    string
}

FormatFieldTag captures effective per-field format-tag attributes compiled into runtime plans.

func ParseFormatFieldTag

func ParseFormatFieldTag(sf reflect.StructField, baseName string) FormatFieldTag

ParseFormatFieldTag parses struct-level `format` tag attributes used by the JSON runtime.

type JSONTag

type JSONTag struct {
	Name      string
	OmitEmpty bool
	Explicit  bool
	Transient bool
}

func ParseJSONTag

func ParseJSONTag(defaultName string, raw string) JSONTag

type ResolvedFieldTag

type ResolvedFieldTag struct {
	Name      string
	Explicit  bool
	OmitEmpty bool
	Ignore    bool
	Inline    bool
	Format    FormatFieldTag
}

func ResolveFieldTag

func ResolveFieldTag(sf reflect.StructField) ResolvedFieldTag

ResolveFieldTag resolves precedence among json, jsonx and format tags. Precedence: 1) json explicit non-empty name/transient wins over format name/case. 2) inline is enabled by anonymous or jsonx:inline or format:inline. 3) ignore is enabled by json:"-" or internal:true or format:ignore. 4) omitempty is enabled by json omitempty OR format omitempty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL