package
0.0.0-20240311143204-56951d66ea65
Repository: https://github.com/dihedron/cq-plugin-utils.git
Documentation: pkg.go.dev

# Functions

Apply returns a ColumnResolver that is made up of a sequence of Transforms whose purpose is that of extracting information from the input, changing it along the way and returning the final value to be stored in the database.
AssertType checks if the input value is of the given (generic) type.
DecodeBase64 decodes the input value (if it is a string) from base64 and returns it as a string.
GetElementAt gets the n-th element from a slice; it returns an error if the value is not an array.
GetMapEntry returns the value associated with the given map key; it assumes that the input value is a map where the key is of type K, and the value is of type V.
NilIfZero returns nil if the current value is the zero value of its respective type.
OnObjectField gets the value from a Golang object by extracting the value associated with the field as per the path.
OrDefault sets the current value to the given default value if it is nil.
RemapValue remaps the current value to a different value according to the input map; it can be used to convert e.g.
TagNameTransformer checks if a struct field is annotated with a "cq-name" tag and if so uses its value as the name of the column in the generated schema.
TagTypeTransformer checks if a struct field is annotated with a "cq-type" tag and if so uses its value as the type of the column in the generated schema.
ToBool converts the current value into its bool representation.
ToInt converts the value to an int; numeric types are cast into an int, whereas strings are parsed.
ToString converts the current value into its string representation.
TrimString assumes that the current valule is a string and trims it of its spaces.

# Constants

NameTag is the tag applied to structs fields to specify a column name.
TypeTag is the tag applied to structs fields to specify a column type.

# Type aliases

Transform is the type of function that transforms a value into another value.