Documentation
¶
Index ¶
- func BitIndices[T constraints.Integer](num T) []int
- func CloneSlice[T Cloner[T]](srcs []T) []T
- func CloneSliceWithCloner[T any](srcs []T, clone func(T) T) []T
- func Crop[T any](slice []T, index int) []T
- func CropElement[T comparable, E ~[]T](slice E, element T) []T
- func CropElements[T comparable, E ~[]T](slice E, elements ...T) []T
- func FindPred[E ~[]T, T any](list E, pred func(T) bool) (T, bool)
- func Indented[T ~string](indent T, strings ...T) []T
- func Intersect[T comparable](list1, list2 []T) []T
- func IsNilOrZero[T any](val T) bool
- func Last[E ~[]T, T any](list E) (T, bool)
- func MapToStruct[T any](m map[string]any) (T, error)
- func MergeMaps[K comparable, V any](target, source map[K]V) map[K]V
- func Repeat[T any](item T, count int) []T
- func Reversed[E ~[]T, T any](list E) []T
- func Same[T comparable](a, b []T) bool
- func SortKeys[K comparable, V any, U ~map[K]V](self U, pred func(a, b K) bool) []K
- func SortedKeys[K constraints.Ordered, V any](self map[K]V) []K
- func Strings[T fmt.Stringer](slice []T) []string
- func StructToMap[T any](t T) (map[string]any, error)
- func TakeOne[TM ~map[TK]TV, TK comparable, TV any](dict TM) (TK, TV)
- func Timestamp(dt time.Time) string
- func TimestampNow() string
- func Transcase(input string, from, to StringCase) string
- func Transform[E ~[]T, T, U any](l E, t func(T) U) []U
- func TypeFor[T any]() reflect.Type
- type BitFlag
- func (bf *BitFlag) Clear(flag BitFlag)
- func (bf *BitFlag) ClearAll()
- func (bf *BitFlag) ClearMany(flags ...BitFlag)
- func (bf *BitFlag) Cleared(flag BitFlag) bool
- func (bf *BitFlag) ClearedAll(flags ...BitFlag) bool
- func (bf *BitFlag) ClearedAny(flags ...BitFlag) bool
- func (bf *BitFlag) Get(flag BitFlag) BitFlag
- func (bf *BitFlag) GetMany(flags ...BitFlag) BitFlag
- func (bf *BitFlag) Set(flag BitFlag)
- func (bf *BitFlag) SetMany(flags ...BitFlag)
- func (bf *BitFlag) Test(flag BitFlag) bool
- func (bf *BitFlag) TestAll(flags ...BitFlag) bool
- func (bf *BitFlag) TestAny(flags ...BitFlag) bool
- func (bf *BitFlag) Toggle(flag BitFlag)
- func (bf *BitFlag) ToggleMany(flags ...BitFlag)
- type Cloner
- type DurationReport
- type FrameStats
- type Pipe
- type StringCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BitIndices ¶ added in v0.0.6
func BitIndices[T constraints.Integer](num T) []int
func CloneSlice ¶
func CloneSlice[T Cloner[T]](srcs []T) []T
func CloneSliceWithCloner ¶
func CloneSliceWithCloner[T any](srcs []T, clone func(T) T) []T
func CropElement ¶ added in v0.0.25
func CropElement[T comparable, E ~[]T](slice E, element T) []T
func CropElements ¶ added in v0.0.25
func CropElements[T comparable, E ~[]T](slice E, elements ...T) []T
func Intersect ¶
func Intersect[T comparable](list1, list2 []T) []T
func IsNilOrZero ¶ added in v0.0.25
func MapToStruct ¶
MapToStruct converts a map to a struct by converting through json
func MergeMaps ¶
func MergeMaps[K comparable, V any](target, source map[K]V) map[K]V
MergeMaps creates a new map and copies target and then source into it
func Same ¶
func Same[T comparable](a, b []T) bool
Same checks if two slices have the same elements in any order
func SortKeys ¶ added in v0.0.25
func SortKeys[K comparable, V any, U ~map[K]V](self U, pred func(a, b K) bool) []K
SortKeys gets a slice of all the keys in a map, sorted by a predicate func
func SortedKeys ¶ added in v0.0.6
func SortedKeys[K constraints.Ordered, V any](self map[K]V) []K
SortedKeys gets a slice of all the keys in a map, sorted
func StructToMap ¶
StructToMap converts a struct to a map by converting through json
func TakeOne ¶ added in v0.0.21
func TakeOne[TM ~map[TK]TV, TK comparable, TV any](dict TM) (TK, TV)
func TimestampNow ¶ added in v0.0.16
func TimestampNow() string
func Transcase ¶ added in v0.0.9
func Transcase(input string, from, to StringCase) string
Types ¶
type BitFlag ¶ added in v0.0.25
type BitFlag uint8
func (*BitFlag) ClearedAll ¶ added in v0.0.25
func (*BitFlag) ClearedAny ¶ added in v0.0.25
func (*BitFlag) ToggleMany ¶ added in v0.0.25
type DurationReport ¶ added in v0.0.25
type FrameStats ¶ added in v0.0.25
func (*FrameStats) AddFrame ¶ added in v0.0.25
func (fs *FrameStats) AddFrame(duration time.Duration)
func (*FrameStats) Report ¶ added in v0.0.25
func (fs *FrameStats) Report() DurationReport
type StringCase ¶ added in v0.0.9
type StringCase int
const ( // camelCaseText CamelCase StringCase = iota // PascalCaseText PascalCase // snake_case_text SnakeCase // Title Case Text TitleCase )
func (StringCase) Parse ¶ added in v0.0.9
func (c StringCase) Parse(phrase string) []string
func (StringCase) Render ¶ added in v0.0.9
func (c StringCase) Render(words []string) string
Click to show internal directories.
Click to hide internal directories.