Documentation ¶
Index ¶
- func BoolStringToInt(s string) int
- func BoolToInt(b bool) int
- func Curr(s interface{}, symbol string) string
- func Dict(values ...any) (dict map[string]any)
- func FloatString(s interface{}, layout string) string
- func IntToBool(i int) bool
- func Map[T any](item T) (m map[string]interface{}, err error)
- func Maps[T any](item []T) (m []map[string]interface{}, err error)
- func Marshal[T any](item T) (content []byte, err error)
- func Marshals[T any](items []T) (content []byte, err error)
- func MustMarshal[T any](item T) (content []byte)
- func Pascal(s string) string
- func Percent(got int, total int) string
- func PermuteStrings(parts ...[]string) (ret []string)
- func PrettyString[T any](item T) (s string)
- func String[T any](item T) (s string)
- func Stringify(r *http.Response) (s string, b []byte)
- func StripIntPrefix(s string) string
- func Title(s string) string
- func Titles(strs ...string) (str string)
- func Unmap[T any](m map[string]interface{}) (item T, err error)
- func Unmaps[T any](m []map[string]interface{}) (items []T, err error)
- func Unmarshal[T any](content []byte) (item T, err error)
- func UnmarshalR[T any](r *http.Response) (item T, err error)
- func Unmarshals[T any](content []byte) (items []T, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolStringToInt ¶
BoolStringToInt helper to deal with get param bools that convert over to 1 | 0 for the db
func BoolToInt ¶
IntToBool helper used with sql conversion as sqlite has no boolean type, they are stored as 1 (true) or 0
func Curr ¶ added in v1.0.0
Curr generates a currency formated string from either a string or float64 value and prepends the symbol to the start Will round to nearest .2 Returns <symbol>0.0 by default
func Dict ¶ added in v1.0.0
Dict generates a map from an even number of arguments (key, value) Used within templates to merge data
func FloatString ¶ added in v1.7.0
func IntToBool ¶
IntToBool helper used with sql conversion as sqlite has no boolean type, they are stored as 1 (true) or 0, this maps them back to a bool
func Map ¶
Map converts a structure into the map of interface by using json marshaling to convert between types
func Maps ¶ added in v1.0.0
Maps converts a slice of structures into the map of interface by using json marshaling to convert between types
func Marshals ¶
Marshals is also a wraper around MarshalIndent, used to keep naming convention of unmarshaling versions
func MustMarshal ¶ added in v1.0.0
func Percent ¶ added in v1.0.0
Percent works out % value of items Used in templates Returns 2 decimals
func PermuteStrings ¶ added in v1.4.0
func PrettyString ¶ added in v1.0.0
PrettyString is similar to String, but retains the indentations
func Stringify ¶
Stringify returns the body content of a http.Response as both a string and []byte. Very helpful for debugging, testing and converting back and forth from the api.
func StripIntPrefix ¶ added in v1.0.0
StripIntPrefix removes chunk of string before the first '.' - this is used in templates to remove integer indexes from strings - will remove all other . from the source string
func Title ¶ added in v1.0.0
Title is used by template helpers to make a "pretty" versions of a column name
team_a => Team A
func Unmarshals ¶
Unmarshals wrapper for mutliple types for shorthand and deals with error logging
Types ¶
This section is empty.