Documentation
¶
Overview ¶
These are a set of very bespoke utilities with specific set of defaults. Not meant to be an exhaustive set of utilities with a wide range of customizations
Index ¶
- func AlphaReverseMap(alphabet string, out map[rune]uint) map[rune]uint
- func EncodeURIComponent(str string) string
- func EnsureDirOf(path string) error
- func EnsureEnvOrDefault(currval string, envvar string, defaultValue string) string
- func ExcelDecode(encoded string, alphabet string, revmap map[rune]uint) uint64
- func ExcelEncode(value uint64, alphabet string) string
- func ExpandUserPath(path string) string
- func GetEnvOrDefault(envvar string, defaultValue string, ensure bool) string
- func GetEnvOrDefaultInt(envvar string, defaultvalue int) (int, error)
- func GetMapField(input StrMap, fieldPath interface{}) (any, error)
- func GetMapFieldForced(input StrMap, fieldPath interface{}) any
- func IsDirEmpty(name string) (bool, error)
- func JsonDecodeBytes(bytes []byte) (interface{}, error)
- func JsonReadFile(path string) (interface{}, error)
- func JsonWriteFile(data interface{}, path string, perm os.FileMode) error
- func PaddedWith(input string, padding byte) string
- func RandString(length int, chars string) string
- type DefaultMap
- type StrMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlphaReverseMap ¶ added in v0.0.64
func EncodeURIComponent ¶ added in v0.0.14
func EnsureDirOf ¶
func EnsureEnvOrDefault ¶ added in v0.0.56
func ExcelDecode ¶ added in v0.0.64
func ExcelEncode ¶ added in v0.0.64
func ExpandUserPath ¶
func GetEnvOrDefault ¶ added in v0.0.56
Gets the value of an environment value and if it is missing returns the default value.
func GetEnvOrDefaultInt ¶ added in v0.0.64
func GetMapField ¶ added in v0.0.38
func GetMapFieldForced ¶ added in v0.0.74
func IsDirEmpty ¶
func JsonDecodeBytes ¶
func JsonReadFile ¶ added in v0.0.24
func JsonWriteFile ¶ added in v0.0.24
func PaddedWith ¶ added in v0.0.64
func RandString ¶ added in v0.0.55
Types ¶
type DefaultMap ¶ added in v0.0.18
type DefaultMap[V interface{}] struct {
// contains filtered or unexported fields
}
func NewDefaultMap ¶ added in v0.0.18
func NewDefaultMap[V any](creator func(key string) V) *DefaultMap[V]
func (*DefaultMap[V]) Ensure ¶ added in v0.0.18
func (tm *DefaultMap[V]) Ensure(key string) V
func (*DefaultMap[V]) Get ¶ added in v0.0.18
func (tm *DefaultMap[V]) Get(key string) (V, bool)
type StrMap ¶ added in v0.0.98
func CopyMapFields ¶ added in v0.0.38
*
- Copy a value in a given field path from the source into a fieldpath in the dest if
- a. source field path is valid and exists
- b. dest field path is valid (or needs to be created).
func SetMapField ¶ added in v0.0.38
*
- Sets a map field at a given field path ensuring that everything until the leaf is a dictionary indeed.
func SetMapFields ¶ added in v0.0.38
*
- SetMapFields takes a map and a list of field paths and values and sets the values in the map
- @param input the map to set the values in
- @param field_paths_and_values a list of field paths and values. The field paths are strings separated by "/" and the values are the values to set
- @return error if there is an error at the first fieldpath that failed.
Click to show internal directories.
Click to hide internal directories.