Documentation ¶
Overview ¶
Contains the gotag.ValueWriterFunc and gotag.ValueReaderFunc default implementations. WriteXxx functions are writers, ReadXxx functions are readers.
Index ¶
- Variables
- func NewArrayValueWriter[S any](writer gotag.ValueWriterFunc[S]) gotag.ValueWriterFunc[[]S]
- func NewBoolWriter(trueValues []string, falseValues []string) gotag.ValueWriterFunc[string]
- func NewMapValueReader[K comparable, V any](keyValueReader gotag.ValueReaderFunc[K], ...) gotag.ValueReaderFunc[map[K]V]
- func NewMapValueWriter[K comparable, V any](keyValueWriter gotag.ValueWriterFunc[K], ...) gotag.ValueWriterFunc[map[K]V]
- func NewSliceValueReader[S any](valueReader gotag.ValueReaderFunc[S]) gotag.ValueReaderFunc[[]S]
- func NewSliceValueWriter[S any](valueWriter gotag.ValueWriterFunc[S]) gotag.ValueWriterFunc[[]S]
- func NewTimeReader(layout string) gotag.ValueReaderFunc[string]
- func NewTimeWriter(layout string) gotag.ValueWriterFunc[string]
- func ReadDuration(v reflect.Value) (string, bool, error)
- func ReadJsonBytes(v reflect.Value) ([]byte, bool, error)
- func ReadJsonString(v reflect.Value) (string, bool, error)
- func ReadStrConvBool(v reflect.Value) (string, bool, error)
- func ReadStrConvComplex(v reflect.Value) (string, bool, error)
- func ReadStrConvFloat(v reflect.Value) (string, bool, error)
- func ReadStrConvInt(v reflect.Value) (string, bool, error)
- func ReadStrConvUint(v reflect.Value) (string, bool, error)
- func ReadString(v reflect.Value) (string, bool, error)
- func ReadXmlBytes(v reflect.Value) ([]byte, bool, error)
- func ReadXmlString(v reflect.Value) (string, bool, error)
- func WriteByteArrayFromReader(v reflect.Value, r io.Reader) (bool, error)
- func WriteBytesFromReader(v reflect.Value, r io.Reader) (bool, error)
- func WriteDuration(v reflect.Value, s string) (bool, error)
- func WriteJsonBytes(v reflect.Value, b []byte) (bool, error)
- func WriteJsonReader(v reflect.Value, r io.Reader) (bool, error)
- func WriteJsonString(v reflect.Value, s string) (bool, error)
- func WriteReaderFromReader[T io.Reader](v reflect.Value, r io.Reader) (bool, error)
- func WriteStrConvBool(v reflect.Value, s string) (bool, error)
- func WriteStrConvComplex(v reflect.Value, s string) (bool, error)
- func WriteStrConvFloat(v reflect.Value, s string) (bool, error)
- func WriteStrConvInt(v reflect.Value, s string) (bool, error)
- func WriteStrConvUint(v reflect.Value, s string) (bool, error)
- func WriteString(v reflect.Value, s string) (bool, error)
- func WriteStringFromReader(v reflect.Value, r io.Reader) (bool, error)
- func WriteStringer(v reflect.Value, s fmt.Stringer) (bool, error)
- func WriteXmlBytes(v reflect.Value, b []byte) (bool, error)
- func WriteXmlReader(v reflect.Value, r io.Reader) (bool, error)
- func WriteXmlString(v reflect.Value, s string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
var ReadStrConv gotag.ValueReaderFunc[string] = gotag.NewFirstSupportedValueReader( ReadStrConvBool, ReadStrConvInt, ReadStrConvUint, ReadStrConvFloat, ReadStrConvComplex, )
A combined gotag.ValueReaderFunc for all strconv [gotag.ValueReaderFunc]s.
var WriteFromReader gotag.ValueWriterFunc[io.Reader] = gotag.NewFirstSupportedValueWriter( WriteByteArrayFromReader, WriteBytesFromReader, WriteReaderFromReader[io.Reader], WriteStringFromReader, )
A combined gotag.ValueWriterFunc for all io.WriteFromReader based [gotag.ValueWriterFunc]s.
var WriteStrConv gotag.ValueWriterFunc[string] = gotag.NewFirstSupportedValueWriter( WriteStrConvBool, WriteStrConvInt, WriteStrConvUint, WriteStrConvFloat, WriteStrConvComplex, )
A combined gotag.ValueWriterFunc for all strconv [gotag.ValueWriterFunc]s.
Functions ¶
func NewArrayValueWriter ¶
func NewArrayValueWriter[S any](writer gotag.ValueWriterFunc[S]) gotag.ValueWriterFunc[[]S]
gotag.ValueWriterFunc that applies another gotag.ValueWriterFunc for all values in an array and sets the value to the reflect.Value. S generic type is the item type in the source slice.
func NewBoolWriter ¶ added in v1.1.0
func NewBoolWriter(trueValues []string, falseValues []string) gotag.ValueWriterFunc[string]
gotag.ValueWriterFunc that checks for a given set of true and false values and sets the bool value to the reflect.Value. It panics if the true and false values have a common value.
func NewMapValueReader ¶
func NewMapValueReader[K comparable, V any](keyValueReader gotag.ValueReaderFunc[K], valueValueReader gotag.ValueReaderFunc[V]) gotag.ValueReaderFunc[map[K]V]
gotag.ValueReaderFunc that applies another gotag.ValueReaderFunc for keys and values in a map and gets them from the reflect.Value. K generic type is the key type in the result map, V generic type is the value type in the result map.
func NewMapValueWriter ¶
func NewMapValueWriter[K comparable, V any](keyValueWriter gotag.ValueWriterFunc[K], valueValueWriter gotag.ValueWriterFunc[V]) gotag.ValueWriterFunc[map[K]V]
gotag.ValueWriterFunc that applies another gotag.ValueWriterFunc for all values in a slice and sets the value to the reflect.Value. S generic type is the item type in the source slice.
func NewSliceValueReader ¶
func NewSliceValueReader[S any](valueReader gotag.ValueReaderFunc[S]) gotag.ValueReaderFunc[[]S]
gotag.ValueReaderFunc that applies another gotag.ValueReaderFunc for all values in a slice or array and gets them from the reflect.Value. S generic type is the item type in the result slice.
func NewSliceValueWriter ¶
func NewSliceValueWriter[S any](valueWriter gotag.ValueWriterFunc[S]) gotag.ValueWriterFunc[[]S]
gotag.ValueWriterFunc that applies another gotag.ValueWriterFunc for all values in a slice and sets the value to the reflect.Value. S generic type is the item type in the source slice.
func NewTimeReader ¶ added in v1.1.0
func NewTimeReader(layout string) gotag.ValueReaderFunc[string]
gotag.ValueReaderFunc that formats time and from the reflect.Value.
func NewTimeWriter ¶ added in v1.1.0
func NewTimeWriter(layout string) gotag.ValueWriterFunc[string]
gotag.ValueWriterFunc that parses time and set it to the reflect.Value.
func ReadDuration ¶ added in v1.1.0
gotag.ValueReaderFunc that formats duration and from the reflect.Value.
func ReadJsonBytes ¶
gotag.ValueReaderFunc that parses the json and sets the value to the reflect.Value.
func ReadJsonString ¶
gotag.ValueReaderFunc that returns the stringified the json from the reflect.Value.
func ReadStrConvBool ¶
gotag.ValueReaderFunc that returns a formatted the bool from the reflect.Value.
func ReadStrConvComplex ¶
gotag.ValueReaderFunc that returns a formatted the complex number from the reflect.Value.
func ReadStrConvFloat ¶
gotag.ValueReaderFunc that returns a formatted the floating point number from the reflect.Value.
func ReadStrConvInt ¶
gotag.ValueReaderFunc that returns a formatted the int from the reflect.Value.
func ReadStrConvUint ¶
gotag.ValueReaderFunc that returns a formatted the unsigned int from the reflect.Value.
func ReadString ¶
gotag.ValueReaderFunc that gets a string value from string reflect.Value.
func ReadXmlBytes ¶
gotag.ValueReaderFunc that parses the xml and sets the value to the reflect.Value.
func ReadXmlString ¶
gotag.ValueReaderFunc that returns the stringified the xml from the reflect.Value.
func WriteByteArrayFromReader ¶
gotag.ValueWriterFunc that reads the io.Reader and sets the content to a byte array reflect.Value.
func WriteBytesFromReader ¶
gotag.ValueWriterFunc that reads the io.Reader and sets the content to a byte slice reflect.Value.
func WriteDuration ¶ added in v1.1.0
gotag.ValueWriterFunc that parses duration and set it to the reflect.Value.
func WriteJsonBytes ¶
gotag.ValueWriterFunc that parses the json and sets the value to the reflect.Value.
func WriteJsonReader ¶
gotag.ValueWriterFunc that reads the reader, parses the json and sets the value to the reflect.Value.
func WriteJsonString ¶
gotag.ValueWriterFunc that parses the json and sets the value to the reflect.Value.
func WriteReaderFromReader ¶
gotag.ValueWriterFunc that passes the io.Reader to a reflect.Value.
func WriteStrConvBool ¶
gotag.ValueWriterFunc that parses the bool and sets the value to the reflect.Value.
func WriteStrConvComplex ¶
gotag.ValueWriterFunc that parses the complex number and sets the value to the reflect.Value.
func WriteStrConvFloat ¶
gotag.ValueWriterFunc that parses the floating point number and sets the value to the reflect.Value.
func WriteStrConvInt ¶
gotag.ValueWriterFunc that parses the integer and sets the value to the reflect.Value.
func WriteStrConvUint ¶
gotag.ValueWriterFunc that parses the unsigned integer and sets the value to the reflect.Value.
func WriteString ¶
gotag.ValueWriterFunc that sets a string value to string reflect.Value.
func WriteStringFromReader ¶
gotag.ValueWriterFunc that reads the io.Reader and sets the content to a string reflect.Value.
func WriteStringer ¶
gotag.ValueWriterFunc that sets the fmt.Stringer formatted string value to string reflect.Value.
func WriteXmlBytes ¶
gotag.ValueWriterFunc that parses the xml and sets the value to the reflect.Value.
func WriteXmlReader ¶
gotag.ValueWriterFunc that reads the reader, parses the xml and sets the value to the reflect.Value.
func WriteXmlString ¶
gotag.ValueWriterFunc that parses the xml and sets the value to the reflect.Value.
Types ¶
This section is empty.