Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustBeStruct ¶
func MustBeStruct(s any)
MustBeStruct panics if the given value is a struct or a pointer to a struct.
Types ¶
type FieldIndexContainer ¶
type FieldIndexContainer []uint16
func NewFieldIndexContainer ¶
func NewFieldIndexContainer(n int) FieldIndexContainer
func (*FieldIndexContainer) Add ¶
func (fic *FieldIndexContainer) Add(fieldPath []int)
func (FieldIndexContainer) Cap ¶
func (f FieldIndexContainer) Cap() int
func (FieldIndexContainer) Len ¶
func (f FieldIndexContainer) Len() int
func (FieldIndexContainer) RangeByFieldPath ¶
func (f FieldIndexContainer) RangeByFieldPath(columnPos []int, fn func(fieldPath []uint16))
type PointerSlicePool ¶
type PointerSlicePool[T any] struct { // contains filtered or unexported fields }
func NewPointerSlicePool ¶
func NewPointerSlicePool[T any](fic FieldIndexContainer) *PointerSlicePool[T]
func (*PointerSlicePool[T]) Release ¶
func (p *PointerSlicePool[T]) Release(s *[]any)
func (*PointerSlicePool[T]) StructFieldPtrs ¶
func (p *PointerSlicePool[T]) StructFieldPtrs(v *T, scopeColIndexes []int) *[]any
type StructField ¶
type StructField struct {
// Path is the path to the field in the struct hierarchy.
// It is represented as a slice of integers, where each integer is the index
// of the field in the parent struct.
Path []int
// Name is the name of the field.
Name string
// Tag is the value of the struct tag.
Tag string
}
StructField represents a field in a struct.
func ExtractStructFields ¶
func ExtractStructFields(ptrToStruct any, tag string) []StructField
ExtractStructFields extracts fields from a struct or a pointer to a struct.
It returns a slice of StructField, which contains the field name, tag value, and the path to the field in the struct hierarchy. The tag parameter specifies the struct tag to look for. The function panics if the input is not a struct or a pointer to a struct. The function does not include unexported fields and fields with a tag value of "-". It also handles embedded structs and nested structs. The path is represented as a slice of integers, where each integer is the index of the field in the parent struct.
type TagPairs ¶
TagPairs represents a map of key-value pairs.
func ParseTagPairs ¶
ParseTagPairs parses a tag string into TagPairsX.