config

package
v0.0.0-...-c5376a2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load() error

func Scan

func Scan(val interface{}) error

Types

type Config

type Config interface {
	Get(string) Value
	Scan(interface{}) error
	Load() error
}
var (
	DefaultConfig Config
)

type JSONValue

type JSONValue struct {
	*simple.Json
}

func NewJSONValue

func NewJSONValue(data []byte) *JSONValue

func (*JSONValue) Bool

func (j *JSONValue) Bool(def bool) bool

func (*JSONValue) Bytes

func (j *JSONValue) Bytes() []byte

func (*JSONValue) Duration

func (j *JSONValue) Duration(def time.Duration) time.Duration

func (*JSONValue) Exists

func (j *JSONValue) Exists() bool

func (*JSONValue) Float64

func (j *JSONValue) Float64(def float64) float64

func (*JSONValue) Int

func (j *JSONValue) Int(def int) int

func (*JSONValue) Scan

func (j *JSONValue) Scan(v interface{}) error

func (*JSONValue) String

func (j *JSONValue) String(def string) string

func (*JSONValue) StringMap

func (j *JSONValue) StringMap(def map[string]string) map[string]string

func (*JSONValue) StringSlice

func (j *JSONValue) StringSlice(def []string) []string

type JSONValues

type JSONValues struct {
	// contains filtered or unexported fields
}

func NewJSONValues

func NewJSONValues(data []byte) *JSONValues

func (*JSONValues) Bytes

func (j *JSONValues) Bytes() []byte

func (*JSONValues) Delete

func (j *JSONValues) Delete(path string, options ...Option)

func (*JSONValues) Get

func (j *JSONValues) Get(path string, options ...Option) Value

func (*JSONValues) Map

func (j *JSONValues) Map() map[string]interface{}

func (*JSONValues) Scan

func (j *JSONValues) Scan(v interface{}) error

func (*JSONValues) Set

func (j *JSONValues) Set(path string, val interface{}, options ...Option)

func (*JSONValues) String

func (j *JSONValues) String() string

type Option

type Option func(o *Options)

func Path

func Path(p string) Option

func SetOption

func SetOption(k, v interface{}) Option

func Type

func Type(t string) Option

type Options

type Options struct {
	Type    string
	Path    string
	Context context.Context
}

type Value

type Value interface {
	Exists() bool
	Bool(def bool) bool
	Int(def int) int
	String(def string) string
	Float64(def float64) float64
	Duration(def time.Duration) time.Duration
	StringSlice(def []string) []string
	StringMap(def map[string]string) map[string]string
	Scan(val interface{}) error
	Bytes() []byte
}

func Get

func Get(path string) Value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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