utils

package
v0.0.0-...-8ff35f7 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 6

Documentation

Overview

Package utils contains a bunch of small functions used by task/ subpackages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateKVList

func ValidateKVList(kind string, list []string, sep rune) error

ValidateKVList makes sure each string in the list is valid key-value pair.

Types

type KV

type KV struct {
	Key   string
	Value string
}

KV is key and value strings.

type KVList

type KVList []KV

KVList if list of KV pairs.

func KVListFromMap

func KVListFromMap(m map[string]string) KVList

KVListFromMap converts a map to KVList.

func UnpackKVList

func UnpackKVList(list []string, sep rune) (out KVList)

UnpackKVList takes validated list of k-v pair strings and returns list of structs.

Silently skips malformed strings. Use ValidateKVList to detect them before calling this function.

func (KVList) Pack

func (l KVList) Pack(sep rune) []string

Pack converts KV list to a list of strings.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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