gotagio

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 9 Imported by: 0

README

gotagio

This package defines the gotag.ValueWriterFunc and gotag.ValueReaderFunc default implementations.

Documentation

Overview

Contains the gotag.ValueWriterFunc and gotag.ValueReaderFunc default implementations. WriteXxx functions are writers, ReadXxx functions are readers.

Index

Constants

This section is empty.

Variables

A combined gotag.ValueReaderFunc for all strconv [gotag.ValueReaderFunc]s.

A combined gotag.ValueWriterFunc for all io.WriteFromReader based [gotag.ValueWriterFunc]s.

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

func ReadDuration(v reflect.Value) (string, bool, error)

gotag.ValueReaderFunc that formats duration and from the reflect.Value.

func ReadJsonBytes

func ReadJsonBytes(v reflect.Value) ([]byte, bool, error)

gotag.ValueReaderFunc that parses the json and sets the value to the reflect.Value.

func ReadJsonString

func ReadJsonString(v reflect.Value) (string, bool, error)

gotag.ValueReaderFunc that returns the stringified the json from the reflect.Value.

func ReadStrConvBool

func ReadStrConvBool(v reflect.Value) (string, bool, error)

gotag.ValueReaderFunc that returns a formatted the bool from the reflect.Value.

func ReadStrConvComplex

func ReadStrConvComplex(v reflect.Value) (string, bool, error)

gotag.ValueReaderFunc that returns a formatted the complex number from the reflect.Value.

func ReadStrConvFloat

func ReadStrConvFloat(v reflect.Value) (string, bool, error)

gotag.ValueReaderFunc that returns a formatted the floating point number from the reflect.Value.

func ReadStrConvInt

func ReadStrConvInt(v reflect.Value) (string, bool, error)

gotag.ValueReaderFunc that returns a formatted the int from the reflect.Value.

func ReadStrConvUint

func ReadStrConvUint(v reflect.Value) (string, bool, error)

gotag.ValueReaderFunc that returns a formatted the unsigned int from the reflect.Value.

func ReadString

func ReadString(v reflect.Value) (string, bool, error)

gotag.ValueReaderFunc that gets a string value from string reflect.Value.

func ReadXmlBytes

func ReadXmlBytes(v reflect.Value) ([]byte, bool, error)

gotag.ValueReaderFunc that parses the xml and sets the value to the reflect.Value.

func ReadXmlString

func ReadXmlString(v reflect.Value) (string, bool, error)

gotag.ValueReaderFunc that returns the stringified the xml from the reflect.Value.

func WriteByteArrayFromReader

func WriteByteArrayFromReader(v reflect.Value, r io.Reader) (bool, error)

gotag.ValueWriterFunc that reads the io.Reader and sets the content to a byte array reflect.Value.

func WriteBytesFromReader

func WriteBytesFromReader(v reflect.Value, r io.Reader) (bool, error)

gotag.ValueWriterFunc that reads the io.Reader and sets the content to a byte slice reflect.Value.

func WriteDuration added in v1.1.0

func WriteDuration(v reflect.Value, s string) (bool, error)

gotag.ValueWriterFunc that parses duration and set it to the reflect.Value.

func WriteJsonBytes

func WriteJsonBytes(v reflect.Value, b []byte) (bool, error)

gotag.ValueWriterFunc that parses the json and sets the value to the reflect.Value.

func WriteJsonReader

func WriteJsonReader(v reflect.Value, r io.Reader) (bool, error)

gotag.ValueWriterFunc that reads the reader, parses the json and sets the value to the reflect.Value.

func WriteJsonString

func WriteJsonString(v reflect.Value, s string) (bool, error)

gotag.ValueWriterFunc that parses the json and sets the value to the reflect.Value.

func WriteReaderFromReader

func WriteReaderFromReader[T io.Reader](v reflect.Value, r io.Reader) (bool, error)

gotag.ValueWriterFunc that passes the io.Reader to a reflect.Value.

func WriteStrConvBool

func WriteStrConvBool(v reflect.Value, s string) (bool, error)

gotag.ValueWriterFunc that parses the bool and sets the value to the reflect.Value.

func WriteStrConvComplex

func WriteStrConvComplex(v reflect.Value, s string) (bool, error)

gotag.ValueWriterFunc that parses the complex number and sets the value to the reflect.Value.

func WriteStrConvFloat

func WriteStrConvFloat(v reflect.Value, s string) (bool, error)

gotag.ValueWriterFunc that parses the floating point number and sets the value to the reflect.Value.

func WriteStrConvInt

func WriteStrConvInt(v reflect.Value, s string) (bool, error)

gotag.ValueWriterFunc that parses the integer and sets the value to the reflect.Value.

func WriteStrConvUint

func WriteStrConvUint(v reflect.Value, s string) (bool, error)

gotag.ValueWriterFunc that parses the unsigned integer and sets the value to the reflect.Value.

func WriteString

func WriteString(v reflect.Value, s string) (bool, error)

gotag.ValueWriterFunc that sets a string value to string reflect.Value.

func WriteStringFromReader

func WriteStringFromReader(v reflect.Value, r io.Reader) (bool, error)

gotag.ValueWriterFunc that reads the io.Reader and sets the content to a string reflect.Value.

func WriteStringer

func WriteStringer(v reflect.Value, s fmt.Stringer) (bool, error)

gotag.ValueWriterFunc that sets the fmt.Stringer formatted string value to string reflect.Value.

func WriteXmlBytes

func WriteXmlBytes(v reflect.Value, b []byte) (bool, error)

gotag.ValueWriterFunc that parses the xml and sets the value to the reflect.Value.

func WriteXmlReader

func WriteXmlReader(v reflect.Value, r io.Reader) (bool, error)

gotag.ValueWriterFunc that reads the reader, parses the xml and sets the value to the reflect.Value.

func WriteXmlString

func WriteXmlString(v reflect.Value, s string) (bool, error)

gotag.ValueWriterFunc that parses the xml and sets the value to the reflect.Value.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL