package
0.0.0-20250225133122-0516d5b855ff
Repository: https://github.com/domonda/go-types.git
Documentation: pkg.go.dev
# Functions
JoinNonEmptyStrings joins only those strings that are not empty/null with the passed separator between them.
JoinTrimmedStrings joins only those strings that are not empty/null with the passed separator between them.
No description provided by the author
NonEmptyStringf formats a string using fmt.Sprintf and returns it as NonEmptyString.
NonEmptyStringFromError converts an error to a NonEmptyString interpreting a nil error as null value "" or else using err.Error() as value.
NonEmptyStringFromPtr converts a string pointer to a NonEmptyString interpreting nil as null value "".
NonEmptyStringTrimSpace returns a NonEmptyString by trimming space from the passed string.
ReflectIsNull returns if a reflect.Value contains either a nil value or implements the Nullable interface and returns true from IsNull or implements the Zeroable interface and returns true from IsZero.
SplitArray splits an SQL or JSON array into its top level elements.
SQLArrayLiteral joins the passed strings as an SQL array literal A nil slice will produce NULL, pass an empty non nil slice to get the empty SQL array literal {}.
TimeFrom returns a nullable.Time from a time.Time.
TimeFromPtr returns a nullable.Time from a time.Time pointer with nil interpreted as null.
TimeNow returns the current time.
TimeParse parses a time value with the provided layout using time.Parse(layout, value) except for when value is on of "", "null", "NULL", then a null/zero time and no error are returned.
TimeParseInLocation parses a time value with the provided layout and location using time.ParseInLocation(layout, value, loc) except for when value is on of "", "null", "NULL", then a null/zero time and no error are returned.
TrimmedStringf formats a string using fmt.Sprintf and returns it as TrimmedString.
TrimmedStringFrom trims the passed str and returns it as TrimmedString An empty trimmed string will be interpreted as null value.
TrimmedStringFromError converts an error to a TrimmedString interpreting a nil error as null value "" or else using err.Error() as value.
TrimmedStringFromPtr converts a string pointer to a TrimmedString interpreting nil as null value "".
# Constants
NonEmptyStringNull is the SQL NULL and JSON null value for NonEmptyString.
TrimmedStringNull is the NULL value "" for TrimmedString.
# Variables
TimeNull is a null Time value.
# Structs
Time represents a time.Time where the zero time instant (which is the empty default value of the type) is interpreted as SQL NULL and JSON null.
# Type aliases
BoolArray implements the sql.Scanner and driver.Valuer interfaces for a slice of bool.
FloatArray implements the sql.Scanner and driver.Valuer interfaces for a slice of float64.
IntArray implements the sql.Scanner and driver.Valuer interfaces for a slice of int64.
JSON is a []byte slice containing JSON text or nil as the representation of the JSON "null" value.
NonEmptyString is a string type where the empty string value is interpreted as SQL NULL and JSON null by implementing the sql.Scanner and driver.Valuer interfaces and also json.Marshaler and json.Unmarshaler.
NullBoolArray implements the sql.Scanner and driver.Valuer interfaces for a slice of sql.NullBool.
NullFloatArray implements the sql.Scanner and driver.Valuer interfaces for a slice of sql.NullFloat64.
NullIntArray implements the sql.Scanner and driver.Valuer interfaces for a slice of sql.NullInt64.
StringArray implements the sql.Scanner and driver.Valuer interfaces for a slice of strings.
TrimmedString is a string type where the empty trimmed string value is interpreted as SQL NULL and JSON null by implementing the sql.Scanner and driver.Valuer interfaces and also json.Marshaler and json.Unmarshaler.