Documentation
¶
Index ¶
- Variables
- func B2N(b []byte) uint64
- func DecodeJson[T any](b []byte) (T, error)
- func DecodeJsonReader[T any](rdr io.Reader) (T, error)
- func DecodeRequestBody[T any](w http.ResponseWriter, r *http.Request) (T, error)
- func JsonIndent(a any) []byte
- func JsonString(a any) string
- func N2B[E constraints.Unsigned](n E) []byte
- func ParseBase[T constraints.Unsigned](in string, base int) (T, error)
- func ParseNumber[T constraints.Unsigned](in string) (T, error)
- func Twist[T ~string](a []string) []T
- func TwistAny[T any, K any](a []T, fn func(v T) K) []K
- func TwistAnyWithError[T any, K any](a []K, fn func(s K) (T, error)) ([]T, error)
- func TwistBack[T ~string](a []T) []string
- func TwistFormat[T any](a []T, fn func(v T) string) []string
- func TwistParse[T any](a []string, fn func(s string) (T, error)) ([]T, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Binary = binary.LittleEndian
View Source
var DebugJsonRequests = true
View Source
var ErrSkip = errors.New("skip error")
View Source
var ErrZeroLength = fmt.Errorf("cannot decode zero length")
ErrZeroLength 404 not found
View Source
var Json = toJson
Functions ¶
func DecodeJson ¶
func DecodeJsonReader ¶
DecodeJsonReader does not close reader. set `DebugJsonRequests = true` for debug logging
func DecodeRequestBody ¶
DecodeRequestBody (and close body)
func JsonString ¶
func ParseBase ¶
func ParseBase[T constraints.Unsigned](in string, base int) (T, error)
ParseBase string->~uint
func ParseNumber ¶
func ParseNumber[T constraints.Unsigned](in string) (T, error)
ParseNumber string->~uint
func TwistAnyWithError ¶
TwistAnyWithError in case theres a parsing issue. skip elements (but continue indexes) by returning ErrSkip in fn function TODO: skip without incrementing index
func TwistFormat ¶
TwistFormat array into a string array
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package constraints defines a set of useful constraints to be used with type parameters.
|
Package constraints defines a set of useful constraints to be used with type parameters. |
Click to show internal directories.
Click to hide internal directories.