config

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 6 Imported by: 1

README

config

Build Status Go Report Card GoDoc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValueNotFound = errors.New("value not found")
	ErrInvalidValue  = errors.New("invalid value")
	ErrUnknowType    = errors.New("unknow type")
	ErrInitFactory   = errors.New("init factory")
	ErrStopWatch     = errors.New("stop watch")
)

Functions

This section is empty.

Types

type Client

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

func Must

func Must(providers ...interface{}) *Client

func New

func New(providers ...interface{}) (*Client, error)

func (*Client) Name

func (c *Client) Name() string

func (*Client) Value

func (c *Client) Value(ctx context.Context, path ...string) (Value, error)

Value get value by name.

func (*Client) Watch

func (c *Client) Watch(ctx context.Context, callback WatchCallback, path ...string) error

type Factory

type Factory func(ctx context.Context, cfg Provider) (Provider, error)

type NamedProvider

type NamedProvider interface {
	Name() string
	Provider
}

type ParseValue

type ParseValue interface {
	ParseString() (string, error)
	ParseInt() (int, error)
	ParseInt64() (int64, error)
	ParseUint() (uint, error)
	ParseUint64() (uint64, error)
	ParseFloat64() (float64, error)
	ParseBool() (bool, error)
	ParseDuration() (time.Duration, error)
	ParseTime() (time.Time, error)
}

type Provider

type Provider interface {
	Value(ctx context.Context, path ...string) (Value, error)
}

type ReadValue

type ReadValue interface {
	String() string
	Int() int
	Int64() int64
	Uint() uint
	Uint64() uint64
	Float64() float64
	Bool() bool
	Duration() time.Duration
	Time() time.Time
}

type UnmarshalValue

type UnmarshalValue interface {
	Unmarshal(val interface{}) error
}

type Value

type Value interface {
	ReadValue
	ParseValue
	UnmarshalValue
	IsEquals(in Value) bool
}

type WatchCallback

type WatchCallback func(ctx context.Context, oldVar, newVar Value) error

type WatchProvider

type WatchProvider interface {
	Watch(ctx context.Context, callback WatchCallback, path ...string) error
}

Directories

Path Synopsis
definition module
provider
arg
env
nolint: nonamedreturns
nolint: nonamedreturns

Jump to

Keyboard shortcuts

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