Files
2025-09-21 16:30:45 +08:00

51 lines
1.2 KiB
Go

package structx
import (
"reflect"
)
// ChangeInfo 变更信息
type ChangeInfo struct {
Old string `json:"old"`
New string `json:"new"`
Val any `json:"val"`
}
// FieldInfo 字段信息
type FieldInfo struct {
Index []int // 字段索引路径
Name string // 字段名
IsPtr bool // 是否为指针
FieldType reflect.Type // 字段类型
IsSlice bool // 是否为切片
IsArray bool // 是否为数组
}
var (
basicStructTypes = map[string]bool{
"time.Time": true,
"github.com/shopspring/decimal.Decimal": true,
"sql.NullString": true,
"sql.NullInt64": true,
"sql.NullBool": true,
"sql.NullFloat64": true,
}
basicKinds = map[reflect.Kind]bool{
reflect.String: true,
reflect.Int: true,
reflect.Int8: true,
reflect.Int16: true,
reflect.Int32: true,
reflect.Int64: true,
reflect.Uint: true,
reflect.Uint8: true,
reflect.Uint16: true,
reflect.Uint32: true,
reflect.Uint64: true,
reflect.Float32: true,
reflect.Float64: true,
reflect.Bool: true,
}
)