tag

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGormTags

func GetGormTags(model any) amap.AMap

GetGormTags analyze gorm tag

func GetJsonTags

func GetJsonTags(model any) amap.AMap

GetJsonTags analyze json tag

func GetTypeTags

func GetTypeTags(typ reflect.Type, tagNames []string, fs ...func(reflect.StructTag) bool) map[string]GF[string]

GetTypeTags use to get the specified tag in the structure fs use to filter specified tags, true means filtering

func IsGormTagIgnore

func IsGormTagIgnore(t reflect.StructTag) bool

IsGormTagIgnore can determine gt-tags whether you do not need to parse

func IsGtTagIgnore

func IsGtTagIgnore(tag reflect.StructTag) bool

IsGtTagIgnore can determine gt-tags whether you do not need to parse

func IsJsonTagIgnore

func IsJsonTagIgnore(t reflect.StructTag) bool

IsJsonTagIgnore can determine gt-tags whether you do not need to parse

func IsTagIgnore

func IsTagIgnore(tag reflect.StructTag, tagName string, exist bool, extTags ...string) bool

IsTagIgnore can determine tags whether you do not need to parse

Types

type FFunc

type FFunc[T any] func(p reflect.StructField) GF[T]

type GF

type GF[T any] map[GtField]T

func GetFieldTag

func GetFieldTag(field reflect.StructField, tagName string, fs ...func(reflect.StructTag) bool) GF[string]

func GetFieldTags

func GetFieldTags(field reflect.StructField, tagNames []string, fs ...func(reflect.StructTag) bool) GF[string]

func GetGtTags

func GetGtTags(model any) GF[GtTags]

GetGtTags gt:"-" gt:"ignore" gt:"sub_sql" gt:"excel:NAME" gt:"field:table.column" gt:"field:table.column;excel:NAME" GetGtTags use to analyze and obtain GT tags in the structure model

func GetTypFor

func GetTypFor[T any](typ reflect.Type, tf TFunc[T], ff FFunc[T]) GF[T]

func GetTypeTag

func GetTypeTag(typ reflect.Type, tagName string, fs ...func(reflect.StructTag) bool) GF[string]

func NewGF

func NewGF[T any]() GF[T]

func ParseGormFieldTag

func ParseGormFieldTag(field reflect.StructField, fs ...func(reflect.StructTag) bool) GF[string]

ParseGormFieldTag only support gorm:column

func ParseGormTags

func ParseGormTags(typ reflect.Type, fs ...func(reflect.StructTag) bool) GF[string]

func ParseGtFieldTag

func ParseGtFieldTag(field reflect.StructField, fs ...func(reflect.StructTag) bool) GF[GtTags]

func ParseGtTags

func ParseGtTags(typ reflect.Type, fs ...func(reflect.StructTag) bool) GF[GtTags]

ParseGtTags use to get all gt tags

func ParseJsonFieldTag

func ParseJsonFieldTag(field reflect.StructField, fs ...func(reflect.StructTag) bool) GF[string]

func ParseJsonTags

func ParseJsonTags(typ reflect.Type, fs ...func(reflect.StructTag) bool) GF[string]

func (GF[T]) Del

func (g GF[T]) Del(key string) GF[T]

Del deletes the values associated with key.

func (GF[T]) Get

func (g GF[T]) Get(key string) T

func (GF[T]) Parse

func (g GF[T]) Parse(f func(T) T) GF[T]

func (GF[T]) Pop

func (g GF[T]) Pop(key string) T

Pop return Get value and Del key

func (GF[T]) Set

func (g GF[T]) Set(key GtField, value T) GF[T]

Set sets the key to value. It replaces string existing values.

func (GF[T]) ToAMap

func (g GF[T]) ToAMap() amap.AMap

func (GF[T]) ToGtTag

func (g GF[T]) ToGtTag() GF[GtTags]

ToGtTag eg: GF[string] to GF[GtTag]

func (GF[T]) Top

func (g GF[T]) Top() T

Top return pop one value

type GtField

type GtField struct {
	Field string
	Type  string
}

type GtTag

type GtTag struct {
	Name  string
	Value string
}

GtTag A GT tag

type GtTags

type GtTags struct {
	GtTags []*GtTag
	// contains filtered or unexported fields
}

func (GtTags) ToAMap

func (g GtTags) ToAMap() amap.AMap

type TFunc

type TFunc[T any] func(p reflect.Type) GF[T]

Jump to

Keyboard shortcuts

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