utils

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendUniq added in v1.7.0

func AppendUniq(list []string, items ...string) []string

AppendUniq does the same thing than append but insure we have only 1 iteam of each

func ConvertJSONRowToSlice

func ConvertJSONRowToSlice(in string) ([]string, error)

ConvertJSONRowToSlice takes a json-formatted array and returns a string slice

func HasDupsArray added in v1.6.0

func HasDupsArray(elements []string) bool

HasDupsArray returns a boolean indicating if array contains duplicates

func HasIntersection added in v1.19.0

func HasIntersection(referenceList []string, items []string) bool

HasIntersection asserts that the given lists have an intersection (a common item) between them

func JSONMarshal added in v1.4.0

func JSONMarshal(obj interface{}) ([]byte, error)

JSONMarshal will JSON encode a given object, without escaping HTML characters

func JSONMarshalIndent added in v1.4.0

func JSONMarshalIndent(obj interface{}, prefix, indent string) ([]byte, error)

JSONMarshalIndent will JSON encode a given object, without escaping HTML characters and indentation

func JSONUseNumber added in v1.6.0

func JSONUseNumber(d *json.Decoder) *json.Decoder

JSONUseNumber returns a json decoder to use numbers while decoding json

func JSONnumberUnmarshal

func JSONnumberUnmarshal(r io.Reader, i interface{}) error

JSONnumberUnmarshal unmarshals a json string with numbers cast as json.Number, not float64 (to avoid scientific notation on large IDs)

func ListContainsString

func ListContainsString(list []string, item string) bool

ListContainsString asserts that a string slice contains a given string

func NormalizeName

func NormalizeName(s string) string

NormalizeName trims leading and trailing spaces on a string, and converts its characters to lowercase

func PrintJSON

func PrintJSON(v interface{})

PrintJSON prints out an interface{} as an indented json string

func StrPtr

func StrPtr(s string) *string

StrPtr returns the pointer to a string's value

func ValidString

func ValidString(field, value string) error

ValidString asserts that a string is within the minimum and maximum length configured for µtask

func ValidText

func ValidText(field, value string) error

ValidText asserts that a long text string is within the minimum and maximum length configured for µtask

func ValidateTags added in v1.8.2

func ValidateTags(tags map[string]string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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