Package Usage: go: github.com/go-pogo/rawconv
Package rawconv implements conversions to and from raw string representations
of any (custom) data type in Go.
Out of the box, this package supports all logical base types and some common types:
Conversions to array, slice or map are done by splitting the raw string. The
separator can be set via the Options type and defaults to DefaultItemsSeparator.
For maps there is also a separator for the key-value pairs, which defaults to
DefaultKeyValueSeparator.
Values within the array, slice, or map are unmarshaled using the called
Unmarshaler. This is also done for keys of maps.
> Nested arrays, slices and maps are not supported.
This package does not contain any logic for traversing struct types, because the
implementation would really depend on the use case. However, it is possible to
incorporate this package in your own struct unmarshaling logic.
Custom types are supported in two ways; by implementing the
encoding.TextUnmarshaler and/or encoding.TextMarshaler interfaces, or by
registering a MarshalFunc with RegisterMarshalFunc and/or an UnmarshalFunc with
RegisterUnmarshalFunc.
If you do not wish to globally expose your MarshalFunc or UnmarshalFunc
implementations, it is possible to register them to a new Marshaler and/or
Unmarshaler and use those instances in your application instead.
14 versions
Latest release: almost 2 years ago
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/go-pogo/rawconv