Documentation ¶
Index ¶
- Constants
- func ExtractTraceSpan(ctx context.Context) (spanCtx context.Context, err error)
- func GetTableColumn(obj interface{}) []string
- func GetTableColumnByTag(obj interface{}, tag string) []string
- func IsNumber(kind reflect.Kind) bool
- func RandString(len int) string
- func StructToMap(obj interface{}) map[string]interface{}
- func StructToMapByJSONTag(obj interface{}) map[string]interface{}
- func UUID() string
- type ColumnField
- type MyStructFields
Constants ¶
View Source
const SpanCtxKey = "span_ctx"
Variables ¶
This section is empty.
Functions ¶
func ExtractTraceSpan ¶
func GetTableColumn ¶
func GetTableColumn(obj interface{}) []string
func GetTableColumnByTag ¶
func StructToMap ¶
func StructToMap(obj interface{}) map[string]interface{}
func StructToMapByJSONTag ¶
func StructToMapByJSONTag(obj interface{}) map[string]interface{}
Types ¶
type ColumnField ¶
type ColumnField struct { Name string Field reflect.StructField }
func NewColumnField ¶
func NewColumnField(field reflect.StructField, name string) ColumnField
type MyStructFields ¶
type MyStructFields struct {
// contains filtered or unexported fields
}
func FieldsFromModel ¶
func FieldsFromModel(m interface{}, db *gorm.DB, recurse bool) (fields MyStructFields)
func FieldsFromStruct ¶
FieldsFromStruct 拿到结构体中的所有属性的字段名,对于嵌套的Struct只递归一次
func (*MyStructFields) Add ¶
func (sf *MyStructFields) Add(fields ...ColumnField)
func (MyStructFields) GetStringField ¶
func (sf MyStructFields) GetStringField() []string
func (*MyStructFields) Merge ¶
func (sf *MyStructFields) Merge(other MyStructFields)
Click to show internal directories.
Click to hide internal directories.