tags

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: GPL-3.0 Imports: 9 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) 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
	RangeMin   *float64
	RangeMax   *float64
	EnumValues []int64
}

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.

Jump to

Keyboard shortcuts

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