utils

package
v0.0.0-...-a0a3655 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

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 IsTransientAPIError

func IsTransientAPIError(err error) bool

IsTransientAPIError returns true if error from Google API client indicates an error that can go away on its own in the future.

func ValidateKVList

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

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

func WrapAPIError

func WrapAPIError(err error) error

WrapAPIError wraps error from Google API client in transient wrapper if necessary.

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