Documentation
¶
Index ¶
- Constants
- func FormatBool(v bool, format string) string
- func GetIndexOfSlice[T any](s []T, i int) (*T, error)
- func IsFieldDelimiter(rn rune) bool
- func IsLiteralEmptyString(b []*byte) bool
- func Map[T any, V any](s []T, fn func(e T, i int, a []T) V) []V
- func ParseBool(str, format string) (bool, error)
- func Resolve(path string) (string, error)
- func RuneToBytes(rs []rune) []byte
- func SerializeValue(v string) string
- func SerializeValues(s []string) []string
- func SplitEscaped(s string) []string
- func SplitQuoted(s string) []string
- func UnwrapStr[t any](a t) string
- type Field
- type SortOption
Constants ¶
const ( CharCharacterTabulation = 0x0009 CharLineFeed = 0x000A CharLineTabulation = 0x000B CharFormFeed = 0x000C CharCarriageReturn = 0x000D CharSpace = 0x0020 CharNextLine = 0x0085 CharNoBreakSpace = 0x00A0 CharOghamSpaceMark = 0x1680 CharEnQuad = 0x2000 CharEmQuad = 0x2001 CharEnSpace = 0x2002 CharEmSpace = 0x2003 CharThreePerEmSpace = 0x2004 CharFourPerEmSpace = 0x2005 CharSixPerEmSpace = 0x2006 CharFigureSpace = 0x2007 CharPunctuationSpace = 0x2008 CharThinSpace = 0x2009 CharHairSpace = 0x200A CharLineSeparator = 0x2028 CharParagraphSeparator = 0x2029 CharNarrowNoBreakSpace = 0x202F CharMediumMathematicalSpace = 0x205F CharIdeographicSpace = 0x3000 )
Variables ¶
This section is empty.
Functions ¶
func FormatBool ¶ added in v1.5.0
FormatBool returns the string representation of a bool in the requested format. Falls back to "True"/"False" if format not found.
func GetIndexOfSlice ¶ added in v1.5.0
func IsFieldDelimiter ¶ added in v1.5.0
func IsLiteralEmptyString ¶ added in v1.5.0
func RuneToBytes ¶ added in v1.5.0
func SerializeValue ¶ added in v1.5.0
Seralizes non null values
- escaping whitespaces, double quoutes, and hyphens from the records value
- `""` for an empty string
func SerializeValues ¶ added in v1.5.0
Maps the `SerializeValue()` function on non-null strings
- escaping whitespaces, double quoutes, and hyphens from the records value
- `""` for an empty string
func SplitEscaped ¶ added in v1.5.0
SplitEscaped splits s by ',' unless the ',' is escaped with '\'
func SplitQuoted ¶ added in v1.5.0
SplitQuoted splits s by [,] unless inside single quotes. Inside quotes, you can escape a single quote with [\']
Types ¶
type Field ¶ added in v1.5.0
type Field struct { IsNull bool Value string FieldIndex int RowIndex int FieldName string IsHeader bool }
func (*Field) CalculateFieldLength ¶ added in v1.5.0
Computes the rune length of the serialized value
func (*Field) SerializeText ¶ added in v1.5.0
Serializes the values of the field
- escaping whitespaces, double quoutes, and hyphens from the records value
- returns the literal `-` character for null
- `""` for an empty string