Help us shape the future of Go! Take the 2026 Go Developer Survey

slicesx

package
v1.21.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int64SliceToString

func Int64SliceToString(intSlice []int64) string

Int64SliceToString stores ids as a comma-separated list ("1,2,3"), the form ParseInt64CSV reads.

func Int64SliceToStringSlice

func Int64SliceToStringSlice(slice []int64) []string

Int64SliceToStringSlice formats each id in decimal.

func ParseInt64CSV added in v1.21.0

func ParseInt64CSV(s string) ([]int64, error)

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

func StringMergeAndRemoveDuplicates(strs ...string) []string

StringMergeAndRemoveDuplicates splits comma-separated lists and merges them into one list without repeated elements, in order of first appearance.

func StringSliceToString

func StringSliceToString(stringSlice []string) string

StringSliceToString stores a list as comma-separated values, without empty and repeated elements.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL