util

package
v9.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultColumnRenameFunction = strings.ToLower
)

Functions

func AppendSliceElement added in v9.2.0

func AppendSliceElement(slice, val reflect.Value)

AppendSliceElement will append val to slice. Handles slice of pointers and not pointers. Val needs to be a pointer.

func AssignStructVals

func AssignStructVals(i interface{}, rd rowData, cm ColumnMap)

AssignStructVals will assign the data from rd to i.

func GetSliceElementType added in v9.2.0

func GetSliceElementType(val reflect.Value) reflect.Type

GetSliceElementType returns the type for a slices elements.

func GetTypeInfo

func GetTypeInfo(i interface{}, val reflect.Value) (reflect.Type, reflect.Kind)

func IsBool

func IsBool(k reflect.Kind) bool

func IsEmptyValue

func IsEmptyValue(v reflect.Value) bool

func IsFloat

func IsFloat(k reflect.Kind) bool

func IsInt

func IsInt(k reflect.Kind) bool

func IsInvalid

func IsInvalid(k reflect.Kind) bool

func IsNil added in v9.19.0

func IsNil(v reflect.Value) bool

func IsPointer

func IsPointer(k reflect.Kind) bool

func IsSlice

func IsSlice(k reflect.Kind) bool

func IsString

func IsString(k reflect.Kind) bool

func IsStruct

func IsStruct(k reflect.Kind) bool

func IsUint

func IsUint(k reflect.Kind) bool

func SafeGetFieldByIndex

func SafeGetFieldByIndex(v reflect.Value, fieldIndex []int) (result reflect.Value, isAvailable bool)

func SafeSetFieldByIndex added in v9.4.0

func SafeSetFieldByIndex(v reflect.Value, fieldIndex []int, src interface{}) (result reflect.Value)

func SetColumnRenameFunction

func SetColumnRenameFunction(newFunction func(string) string)

func SetIgnoreUntaggedFields added in v9.14.0

func SetIgnoreUntaggedFields(ignore bool)

Types

type ColumnData

type ColumnData struct {
	ColumnName     string
	FieldIndex     []int
	ShouldInsert   bool
	ShouldUpdate   bool
	DefaultIfEmpty bool
	OmitNil        bool
	OmitEmpty      bool
	GoType         reflect.Type
}

type ColumnMap

type ColumnMap map[string]ColumnData

func GetColumnMap

func GetColumnMap(i interface{}) (ColumnMap, error)

func (ColumnMap) Cols

func (cm ColumnMap) Cols() []string

func (ColumnMap) Merge added in v9.7.1

func (cm ColumnMap) Merge(colMaps []ColumnMap) ColumnMap

type ValueSlice

type ValueSlice []reflect.Value

func (ValueSlice) Equal

func (vs ValueSlice) Equal(other ValueSlice) bool

func (ValueSlice) Len

func (vs ValueSlice) Len() int

func (ValueSlice) Less

func (vs ValueSlice) Less(i, j int) bool

func (ValueSlice) String

func (vs ValueSlice) String() string

func (ValueSlice) Swap

func (vs ValueSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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