tagutil

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	HasCaseFormat 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
	// CaseExplicit prevents global case formatting for JSON names and field case overrides.
	// Explicit also includes format names, preserving inline and custom-transform behavior.
	CaseExplicit 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. A format name remains eligible for global case formatting unless the field sets caseFormat. 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