Documentation
¶
Overview ¶
Package tostring provides functionality to convert arbitrary Go values into their string representation, while also detecting NULL or zero-equivalent values. It is primarily used for consistent string serialization in data export scenarios.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type String ¶
String represents a string value along with a flag indicating whether it was NULL. If IsNULL is true, then the value should be considered as NULL or absent.
func ToString ¶
ToString converts an arbitrary value to a String type, which contains a string representation of the value and a flag indicating if the value was NULL.
The conversion logic supports common Go primitive types, slices, time.Time, and types implementing json.Marshaler or fmt.Stringer interfaces.
If the input is nil or represents an empty/null value (like zero time, "null", "[]", or "{}" in JSON), the result will have IsNULL set to true.