Documentation
¶
Overview ¶
Package util implements other tool more, like type cover, type value check.
Index ¶
- Constants
- func DecT36(num int) string
- func DecT62(num int) string
- func MapToStructViaJson(mapValue any, structPtr any) error
- func NullDefault(value, def any) any
- func Round(num float64, b int) float64
- func StructToMap(value any, ignoreKeys ...string) map[string]any
- func StructToMapLStyle(value any, ignoreKeys ...string) map[string]any
- func StructToMapViaJson(value any, ignoreKeys ...string) map[string]any
- func ToMapLStyleIgnoreEmpty(value any, ignoreKeys ...string) map[string]any
- func TryAssignValue(src reflect.Value, tgt reflect.Value) bool
- func ValueNull(value any) bool
- type Decimal
- type Object
Constants ¶
const ( // NumberStr 9+26+26+3 NumberStr = "0123456789abcdefghijklmnopkrstuvwxyzABCDEFGHIJKLMNOPKRSTUVWXYZ+-=" // N2 进制类型 N2 = 2 N8 = 8 N16 = 16 N32 = 32 N36 = 36 N62 = 62 )
@Date: 2018/12/12 0012 13:45 @Author: Joshua Conero @Name: 10 进制处理
Variables ¶
This section is empty.
Functions ¶
func MapToStructViaJson ¶
MapToStructViaJson use the map value to set structPtr
func StructToMap ¶
StructToMap convert Struct field to by Map, support the Ptr
func StructToMapLStyle ¶
StructToMapLStyle convert Struct field to by Map and key is Lower style, key support `JSON.TAG`. Notice: reflect field num not contain inherit struct.
func StructToMapViaJson ¶
StructToMapViaJson convert map via json Marshal/Unmarshal StructToMapViaJson is slower than StructToMapLStyle by Benchmark
func ToMapLStyleIgnoreEmpty ¶
ToMapLStyleIgnoreEmpty convert Struct field to by Map and key is Lower style and ignore empty. StructToMapViaJson is slower than StructToMapLStyle by Benchmark
func TryAssignValue ¶
TryAssignValue try assign value to another value.
Types ¶
type Object ¶
type Object struct { }
func (Object) Assign ¶
Assign Base of `reflect` to come true like javascript `Object.Assign`, target should be pointer best. It can be Multiple, only for `reflect.Map`. And support nested struct. @todo 将使用 reflect 与 未使用reflect从包去区分开
func (Object) AssignCovert ¶
AssignCovert Simple type automatic coverage, supporting cross type. So do not try to cover complex type. number covert any -> string string -> number
Directories
¶
Path | Synopsis |
---|---|
Package netutil net util, Web related assistant tools
|
Package netutil net util, Web related assistant tools |
Package fs support facilitate for handler file and direction.
|
Package fs support facilitate for handler file and direction. |
Package tm assistant methods related to time reporting
|
Package tm assistant methods related to time reporting |
Package test unit.
|
Package test unit. |
Package xsql extends for the sql package.
|
Package xsql extends for the sql package. |