Documentation ¶
Index ¶
- func SliceCopy[S ~[]T, T any](a S) S
- func SliceDelete[S ~[]T, T comparable](arr S, values ...T) S
- func SliceHas[S ~[]T, T comparable](arr S, values ...T) bool
- func SliceIndex[S ~[]T, T comparable](arr S, values ...T) int
- func SliceJoin[T any](arr []T, sep string) string
- func SliceJoinFormat[T any](arr []T, format func(val T) string, sep string) string
- func SliceMerge[S ~[]T, T any](items ...S) S
- func SliceUnique[S ~[]T, T comparable](arr S) S
- func SliceValuesAllow[T comparable](values []T, allow []T) error
- func SubStr(str string, offset int, length int) string
- type Complex
- type EnableStatus
- type Float
- type GroupEnableStatus
- type Integer
- type Ordered
- type Signed
- type String
- func (s String) Int16Slice(sep string) ([]int16, error)
- func (s String) Int32Slice(sep string) ([]int32, error)
- func (s String) Int64Slice(sep string) ([]int64, error)
- func (s String) Int8Slice(sep string) ([]int8, error)
- func (s String) IntSlice(sep string) ([]int, error)
- func (s String) Split(sep string) []string
- func (s String) SubStr(offset int, length int) String
- func (s String) Uint16Slice(sep string) ([]uint16, error)
- func (s String) Uint32Slice(sep string) ([]uint32, error)
- func (s String) Uint64Slice(sep string) ([]uint64, error)
- func (s String) Uint8Slice(sep string) ([]uint8, error)
- func (s String) UintSlice(sep string) ([]uint, error)
- type StringSlice
- type Unsigned
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SliceCopy ¶ added in v0.0.6
func SliceCopy[S ~[]T, T any](a S) S
SliceCopy 复制一个 slice
若原 slice == nil 会返回 nil 其他情况总是返回一个新的 slice,及时 len == 0
func SliceDelete ¶ added in v0.0.6
func SliceDelete[S ~[]T, T comparable](arr S, values ...T) S
func SliceHas ¶ added in v0.0.6
func SliceHas[S ~[]T, T comparable](arr S, values ...T) bool
func SliceIndex ¶ added in v0.0.6
func SliceIndex[S ~[]T, T comparable](arr S, values ...T) int
func SliceJoinFormat ¶ added in v0.0.6
func SliceMerge ¶ added in v0.0.5
func SliceMerge[S ~[]T, T any](items ...S) S
SliceMerge merge 多个 slice 为一个,并最终返回一个新的 slice
func SliceUnique ¶ added in v0.0.6
func SliceUnique[S ~[]T, T comparable](arr S) S
func SliceValuesAllow ¶ added in v0.0.6
func SliceValuesAllow[T comparable](values []T, allow []T) error
Types ¶
type Complex ¶ added in v0.0.5
type Complex interface { ~complex64 | ~complex128 }
type EnableStatus ¶ added in v0.0.5
type EnableStatus int32
EnableStatus enable and disable status, default value is enable
func (*EnableStatus) Disable ¶ added in v0.0.5
func (es *EnableStatus) Disable()
Disable set status disable
func (*EnableStatus) Enable ¶ added in v0.0.5
func (es *EnableStatus) Enable()
Enable set status enable
func (*EnableStatus) IsEnable ¶ added in v0.0.5
func (es *EnableStatus) IsEnable() bool
IsEnable return is enable
func (*EnableStatus) SetEnable ¶ added in v0.0.5
func (es *EnableStatus) SetEnable(enable bool)
SetEnable set status
func (*EnableStatus) String ¶ added in v0.0.5
func (es *EnableStatus) String() string
String return status desc
type GroupEnableStatus ¶ added in v0.0.5
type GroupEnableStatus struct { // Default 未设置时的默认值 Default bool // contains filtered or unexported fields }
GroupEnableStatus 一组状态,默认未设置会返回 false
func (*GroupEnableStatus) IsEnable ¶ added in v0.0.5
func (gs *GroupEnableStatus) IsEnable(key any) bool
IsEnable 获取状态
func (*GroupEnableStatus) Range ¶ added in v0.0.5
func (gs *GroupEnableStatus) Range(fn func(key any, enable bool) bool)
Range 遍历所有已设置的值
func (*GroupEnableStatus) SetAllEnable ¶ added in v0.0.5
func (gs *GroupEnableStatus) SetAllEnable(enable bool)
SetAllEnable 设置所有的状态,设置后,也会调整默认状态为此值
如 默认值为 false,若 key="key123" 未设置,调用 IsEnable("key123") 会返回 false, 当 SetAllEnable(true) 之后,再次调用 IsEnable("key123") 会返回 true
func (*GroupEnableStatus) SetEnable ¶ added in v0.0.5
func (gs *GroupEnableStatus) SetEnable(key any, enable bool)
SetEnable 设置状态
func (*GroupEnableStatus) String ¶ added in v0.0.5
func (gs *GroupEnableStatus) String() string
String 打印出所有已经设置的状态信息
type String ¶
type String string
String 字符串
func (String) Int16Slice ¶ added in v0.0.5
Int16Slice 转换为 []int16
func (String) Int32Slice ¶ added in v0.0.5
Int32Slice 转换为 []int32
func (String) Int64Slice ¶ added in v0.0.5
Int64Slice 转换为 []int32
func (String) Uint16Slice ¶ added in v0.0.5
Uint16Slice 转换为 []uint16
func (String) Uint32Slice ¶ added in v0.0.5
Uint32Slice 转换为 []uint32
func (String) Uint64Slice ¶ added in v0.0.5
Uint64Slice 转换为 []uint64
func (String) Uint8Slice ¶ added in v0.0.5
Uint8Slice 转换为 []uint8
type StringSlice ¶
type StringSlice []string
StringSlice alias off []string
func (*StringSlice) Delete ¶ added in v0.0.5
func (ss *StringSlice) Delete(values ...string)
Delete 删除对应的值
Click to show internal directories.
Click to hide internal directories.