tags

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToSnakeCase added in v0.8.0

func ToSnakeCase(str string) string

Types

type Cache added in v0.8.0

type Cache struct {
	Mapper *reflectx.Mapper
	// contains filtered or unexported fields
}

Cache caches the result of field/tag parsing for each type.

func NewCache added in v0.8.0

func NewCache(mapper *reflectx.Mapper) *Cache

NewCache initializes a new cache.

func (*Cache) GetHeader added in v0.8.0

func (c *Cache) GetHeader(ent interface{}) ([]string, error)

Header returns the field names in the same order as the struct definition.

func (*Cache) GetInsert added in v0.8.0

func (c *Cache) GetInsert(ent any, header []string) ([]any, error)

GetInsert returns values in the same order as the header.

func (*Cache) GetSortColumns added in v1.3.3

func (c *Cache) GetSortColumns(ent interface{}) []*FieldInfo

GetSortColumns returns the entity's fields tagged with standardized_sort, sorted ascending by SortOrder.

func (*Cache) GetStructTagMap added in v0.8.0

func (c *Cache) GetStructTagMap(ent interface{}) FieldMap

GetStructTagMap .

type FieldInfo added in v0.8.0

type FieldInfo struct {
	Name           string
	Required       bool
	Target         string
	Index          []int
	GreaterThan    *float64
	LessThan       *float64
	GreaterOrEqual *float64
	LessOrEqual    *float64
	EnumValues     []int64
	SortOrder      int
	Kind           SortKind
}

FieldInfo contains the parsed tag values for a single attribute.

type FieldMap added in v0.8.0

type FieldMap map[string]*FieldInfo

FieldMap contains all the parsed tags for a struct.

type SortKind added in v1.3.3

type SortKind int

SortKind is the underlying primitive class of a struct field, used to drive type-aware sorting on serialized CSV cells.

const (
	SortKindUnknown SortKind = iota
	SortKindString
	SortKindInt
	SortKindFloat
	SortKindDate
)

Jump to

Keyboard shortcuts

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