util

package
v9.0.0-...-c490369 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 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

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 any, rd rowData, cm ColumnMap)

AssignStructVals will assign the data from rd to i.

func GetSliceElementType

func GetSliceElementType(val reflect.Value) reflect.Type

GetSliceElementType returns the type for a slices elements.

func GetTypeInfo

func GetTypeInfo(i any, 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 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

func SafeSetFieldByIndex(v reflect.Value, fieldIndex []int, src any) (result reflect.Value)

func SetColumnRenameFunction

func SetColumnRenameFunction(newFunction func(string) string)

func SetIgnoreUntaggedFields

func SetIgnoreUntaggedFields(ignore bool)

Types

type ColumnData

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

type ColumnMap

type ColumnMap map[string]ColumnData

func GetColumnMap

func GetColumnMap(i any) (ColumnMap, error)

func (ColumnMap) Cols

func (cm ColumnMap) Cols() []string

func (ColumnMap) Merge

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