spec

package
v0.0.0-...-349f3ea Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KiB = 1024
	MiB = 1024 * KiB
	GiB = 1024 * MiB
	KB  = 1000
	MB  = 1000 * KB
	GB  = 1000 * MB
)

Variables

This section is empty.

Functions

func ConvertTimeLayout

func ConvertTimeLayout(s string) string

func ParseSpec

func ParseSpec(spec, tagName string, v interface{}, options ...SpecOptionsFn) error

ParseSpec parses a specification to a structure.

func ParseSpecMap

func ParseSpecMap(query string) map[string]string

ParseSpecMap parses the guava cache specification like string and returns a map listing the values specified for each key. ParseSpecMap always returns a non-nil map containing all the valid query parameters found; err describes the first decoding error encountered, if any.

Query is expected to be a list of key=value settings separated by ampersands or semicolons or comma. A setting without an equals sign is interpreted as a key set to an empty value.

Types

type Layout

type Layout string

func (*Layout) Parse

func (l *Layout) Parse(s string) error

type Parser

type Parser interface {
	Parse(string) error
}

type Size

type Size int

func (*Size) Parse

func (size *Size) Parse(s string) error

type SpecOptions

type SpecOptions struct {
	EnvPrefix string
}

type SpecOptionsFn

type SpecOptionsFn func(*SpecOptions)

func WithEnvPrefix

func WithEnvPrefix(v string) SpecOptionsFn

type SpecOptionsFns

type SpecOptionsFns []SpecOptionsFn

func (SpecOptionsFns) CreateOptions

func (r SpecOptionsFns) CreateOptions() *SpecOptions

Jump to

Keyboard shortcuts

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