Documentation
¶
Overview ¶
Package slicesx converts the lists the database stores as comma-separated strings, such as plan and node id lists, to and from slices, and deduplicates slices while keeping their order.
Index ¶
- func Int64SliceToString(intSlice []int64) string
- func Int64SliceToStringSlice(slice []int64) []string
- func ParseInt64CSV(s string) ([]int64, error)
- func RemoveDuplicateElements[T comparable](input ...T) []T
- func StringMergeAndRemoveDuplicates(strs ...string) []string
- func StringSliceToString(stringSlice []string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Int64SliceToString ¶
Int64SliceToString stores ids as a comma-separated list ("1,2,3"), the form ParseInt64CSV reads.
func Int64SliceToStringSlice ¶
Int64SliceToStringSlice formats each id in decimal.
func ParseInt64CSV ¶ added in v1.21.0
ParseInt64CSV parses a comma-separated list of integers, such as the id lists Int64SliceToString stores ("1,2,3"). Blank input is an empty (nil) list and space around an element is ignored. Any element that is not an integer, an empty one included, fails the whole list: a damaged value is never mistaken for a shorter list — for a coupon's plan list, a shorter or empty list would widen what the coupon applies to.
func RemoveDuplicateElements ¶
func RemoveDuplicateElements[T comparable](input ...T) []T
RemoveDuplicateElements returns input without repeated elements, in order of first appearance. Empty strings are dropped too.
func StringMergeAndRemoveDuplicates ¶
StringMergeAndRemoveDuplicates splits comma-separated lists and merges them into one list without repeated elements, in order of first appearance.
func StringSliceToString ¶
StringSliceToString stores a list as comma-separated values, without empty and repeated elements.
Types ¶
This section is empty.