utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = fmt.Errorf("not implemented")

Functions

func Describe

func Describe(value any) string

returns a string with the value and its underlying type

useful for providing meaningful error messages when a type coercion fails

func Env

func Env(path string) error

load environment variables from path

func Prettier

func Prettier(v any) string

provides a more human readable string representation of v

func WriteJSON

func WriteJSON(name, dir string, raw map[string][]byte) error

Types

type Case

type Case struct {
	Check   bool // case fails if check is true
	Message string
	Args    []any // deprecated
}

func NewCase

func NewCase(check bool, msg string, args ...any) *Case

type Cases

type Cases []*Case

func (*Cases) Append

func (cases *Cases) Append(c ...*Case)

func (Cases) Iterator

func (cases Cases) Iterator(onCheck func(c *Case))

runs onCheck when a case's Check is true

Jump to

Keyboard shortcuts

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