Documentation
¶
Index ¶
- func Bool(v interface{}) bool
- func Cond(cond bool, trueVal interface{}, falseVal interface{}) interface{}
- func CopyStruct(src, dst interface{})
- func EmptyCond(v interface{}, elseVal interface{}) interface{}
- func Float32(v interface{}) float32
- func Float64(v interface{}) float64
- func Int(v interface{}) int
- func Int32(v interface{}) int32
- func Int64(v interface{}) int64
- func IsEmpty(v interface{}) bool
- func IsList(i interface{}) bool
- func IsMap(v interface{}) bool
- func IsNil(i interface{}) bool
- func NilCond(v interface{}, elseVal interface{}) interface{}
- func RandNumericString(len int) string
- func RandString(len int) string
- func String(v interface{}) string
- func SubString(str string, start, end int) string
- func Uint(v interface{}) uint
- func Uint32(v interface{}) uint32
- func Uint64(v interface{}) uint64
- type KVPair
- type KVPairs
- func (p KVPairs) Add(k, v string)
- func (p KVPairs) EscapedString() string
- func (p KVPairs) FilterEmptyValueAndKeys(keys ...string) KVPairs
- func (p KVPairs) Len() int
- func (p KVPairs) Less(i, j int) bool
- func (p KVPairs) QuotedAndEscapedString() string
- func (p KVPairs) QuotedString() string
- func (p KVPairs) Reverse()
- func (p KVPairs) Sort()
- func (p KVPairs) String() string
- func (p KVPairs) Swap(i, j int)
- func (p KVPairs) ToMap() map[string]string
- func (p KVPairs) ToXML() string
- type M
- func (m M) Contains(k string) bool
- func (m M) DefaultGet(k string, dv interface{}) interface{}
- func (m M) DefaultGetBool(k string, b bool) bool
- func (m M) DefaultGetFloat64(k string, f float64) float64
- func (m M) DefaultGetInt(k string, i int) int
- func (m M) DefaultGetInt64(k string, i int64) int64
- func (m M) DefaultGetString(k, s string) string
- func (m M) DefaultGetUint(k string, i uint) uint
- func (m M) DefaultGetUint64(k string, i uint64) uint64
- func (m M) Del(k string)
- func (m M) ForceMerge(n M)
- func (m M) Get(k string) (interface{}, bool)
- func (m M) GetBool(k string) bool
- func (m M) GetByPath(path string) (interface{}, bool)
- func (m M) GetFloat32(k string) float32
- func (m M) GetFloat64(k string) float64
- func (m M) GetInt(k string) int
- func (m M) GetInt64(k string) int64
- func (m M) GetJson(k string) string
- func (m M) GetString(k string) string
- func (m M) GetUint(k string) uint
- func (m M) GetUint64(k string) uint64
- func (m M) IsArray(k string) bool
- func (m M) IsEmpty(k string) bool
- func (m M) Json() string
- func (m M) Keys() []string
- func (m M) MVal(k string) M
- func (m M) MValByPath(path string) (M, bool)
- func (m M) Map() map[string]interface{}
- func (m M) Merge(n M)
- func (m M) Pairs() KVPairs
- func (m M) SMVal(k string) []M
- func (m M) SMValByPath(path string) ([]M, bool)
- func (m M) SVal(k string) S
- func (m M) SValByPath(path string) (S, bool)
- func (m M) Size() int
- func (m M) UrlQuery() string
- func (m M) UrlValues() url.Values
- type S
- func (s S) Contains(v interface{}) bool
- func (s S) Extend(f func(interface{}) string) *XS
- func (s S) Filter()
- func (s S) Float64() []float64
- func (s S) Int() []int
- func (s S) Int64() []int64
- func (s S) Interface() []interface{}
- func (s S) Json() string
- func (s *S) Load(v []byte) error
- func (s S) M() []M
- func (s S) Size() int
- func (s S) String() []string
- func (s S) Uint() []uint
- func (s S) Uint64() []uint64
- type Tree
- type TreeItem
- type XS
- func (xs *XS) Add(args ...interface{})
- func (xs *XS) Contains(v interface{}) bool
- func (xs *XS) Delete(arg interface{})
- func (xs *XS) Intersect(arrs ...S) *XS
- func (xs *XS) SAdd(args ...interface{})
- func (xs *XS) Size() int
- func (xs *XS) Slice() []interface{}
- func (xs *XS) Union(arrs ...S) *XS
- func (xs *XS) Unique() []interface{}
- func (xs *XS) UniqueFilter(f func(string) bool) []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
func Bool(v interface{}) bool
Bool 将任意值转换成bool类型 注意:1. 当无法或者不支持转换时,此接口将返回0值;
- 此接口应当只在明确数据内容只是需要类型转换时使用,不应当用于对未知值进行转换。
func Cond ¶
func Cond(cond bool, trueVal interface{}, falseVal interface{}) interface{}
Cond 条件表达式,用于实现三元运算符的功能,if cond == true then trueVal else falseVal
func EmptyCond ¶
func EmptyCond(v interface{}, elseVal interface{}) interface{}
EmptyCond 判断值v,如果为空(零值或者nil),则返回elseVal,否则返回v本身
func Float64 ¶
func Float64(v interface{}) float64
Float64 将任意值转换成float64类型 注意:1. 当无法或者不支持转换时,此接口将返回0值;
- 此接口应当只在明确数据内容只是需要类型转换时使用,不应当用于对未知值进行转换。
func Int64 ¶
func Int64(v interface{}) int64
Int64 将任意值转换成int64类型 注意:1. 当无法或者不支持转换时,此接口将返回0值;
- 此接口应当只在明确数据内容只是需要类型转换时使用,不应当用于对未知值进行转换。
func NilCond ¶
func NilCond(v interface{}, elseVal interface{}) interface{}
NilCond 判断值v,如果等于nil,则返回elseVal,否则返回v本身
Types ¶
type KVPairs ¶
type KVPairs []KVPair
KVPairs 参数键值对列表
func (KVPairs) EscapedString ¶
EscapedString 将所有元素按照“参数=urlencode(参数值)”的模式用“&”字符拼接成字符串
func (KVPairs) FilterEmptyValueAndKeys ¶
FilterEmptyValueAndKeys 去掉列表中值为空以及指定字段的值
func (KVPairs) QuotedAndEscapedString ¶
QuotedAndEscapedString 自定义值的处理方式
func (KVPairs) QuotedString ¶
QuotedString 将所有元素按照“参数="参数值"”的模式用“&”字符拼接成字符串
type M ¶
type M map[string]interface{}
M 常用的map类型
func (M) DefaultGet ¶
DefaultGet 获取配置项k的值,如果不存在则返回默认值
func (M) DefaultGetString ¶
DefaultGetString 获取指定K的值,如果K不存在,则返回默认值
func (M) GetFloat32 ¶
func (M) GetFloat64 ¶
type S ¶
type S []interface{}
S 常用的slice类型
type TreeItem ¶
type TreeItem interface {
Key() string
ParentKey() string
AddChild(ti TreeItem)
GetChild(k string) (TreeItem, bool)
}
TreeItem 定义构成树的元素接口
Click to show internal directories.
Click to hide internal directories.