Documentation
¶
Overview ¶
Package std provides tools for standard types (strings, int, floats, etc).
Index ¶
- func Clone[T any](input T) T
- func CloneMap[M ~map[K]V, K comparable, V any](m M) M
- func CloneSlice[S ~[]E, E any](s S) S
- func CommonPrefixLen[T bytesec](a T, b T) int
- func CryptoRandKey(n int) (string, error)
- func DeepClone[T any](t T) (dst T)
- func DiffSlices[S ~[]E, E comparable](prev S, next S) (added S, removed S)
- func FormatPath(ii ...interface{}) string
- func ParseCellsDuration(s string) (time.Duration, error)
- func Randkey(n int) string
- func Retry(ctx context.Context, f func() error, seconds ...time.Duration) error
- func StringToKeys(s ...string) []string
- func TopologicalSort[T nameable](objects []TopologicalObject[T]) ([]T, error)
- func Unique[V comparable, T []V](input T) T
- type Cloneable
- type TopologicalObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneMap ¶
func CloneMap[M ~map[K]V, K comparable, V any](m M) M
Clone returns a copy of m. This is a shallow clone: the new keys and values are set using ordinary assignment.
func CloneSlice ¶
func CloneSlice[S ~[]E, E any](s S) S
Clone returns a copy of the slice. The elements are copied using assignment, so this is a shallow clone.
func CommonPrefixLen ¶
func CommonPrefixLen[T bytesec](a T, b T) int
func CryptoRandKey ¶
CryptoRandKey generates a cryptographically secure random string of length n. It uses base64 encoding to represent the random bytes.
func DiffSlices ¶
func DiffSlices[S ~[]E, E comparable](prev S, next S) (added S, removed S)
DiffSlices finds added and removed values between previous and next
func FormatPath ¶
func FormatPath(ii ...interface{}) string
func ParseCellsDuration ¶
ParseCellsDuration wraps standard time.ParseDuration supporting the "d" unit (as day)
func StringToKeys ¶
func TopologicalSort ¶
func TopologicalSort[T nameable](objects []TopologicalObject[T]) ([]T, error)
func Unique ¶
func Unique[V comparable, T []V](input T) T
Types ¶
type TopologicalObject ¶
type TopologicalObject[T nameable] struct {
Object T
After []string
}
Click to show internal directories.
Click to hide internal directories.