configure

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExceedDeepLevel = "substratum: only support two level map/array"
)

Variables

View Source
var EmptyOptions = func() *Options {
	return &Options{}
}

Functions

func RegisterBackendImplementor added in v1.1.0

func RegisterBackendImplementor(backend Backend)

RegisterBackendImplementor registers the configuration backend service implementor.

func RegisterCallbackImplementor added in v1.1.0

func RegisterCallbackImplementor(callback Callback)

RegisterCallbackImplementor registers the value updated callback service implementor.

func RegisterImplementor

func RegisterImplementor(cfg Configure)

RegisterImplementor registers the configuration service implementor.

Types

type AddrParams added in v1.1.0

type AddrParams map[string]string

func (AddrParams) Encode added in v1.1.0

func (m AddrParams) Encode(sep string) string

type Address added in v1.1.0

type Address struct {
	Schema    Schema     `json:"schema"`
	Username  string     `json:"username"`
	Password  string     `json:"password"`
	Host      string     `json:"host"`
	Port      string     `json:"port"`
	NameSpace string     `json:"namespace"`
	Params    AddrParams `json:"params"`
	RawValue  string     `json:"raw"`
}

func (*Address) Set added in v1.1.0

func (c *Address) Set(addr string)

type Array added in v1.1.0

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

func (*Array) ArrayAt added in v1.1.0

func (t *Array) ArrayAt(i int) *embedArray

func (*Array) AtomicUpdate added in v1.1.0

func (t *Array) AtomicUpdate(v string)

func (*Array) Bools added in v1.1.0

func (t *Array) Bools() []*embedBool

func (*Array) Changed added in v1.1.0

func (t *Array) Changed(evt UpdateEvent)

func (*Array) Floats added in v1.1.0

func (t *Array) Floats() []*embedFloat

func (*Array) Ints added in v1.1.0

func (t *Array) Ints() []*embedInt

func (*Array) Len added in v1.1.0

func (t *Array) Len() int

func (*Array) String added in v1.1.0

func (t *Array) String() string

func (*Array) Strings added in v1.1.0

func (t *Array) Strings() []*embedString

func (*Array) Uints added in v1.1.0

func (t *Array) Uints() []*embedUint

type Backend added in v1.1.0

type Backend interface {
	// Type returns the backend provider type.
	Type() string

	// Set value for the specified key.
	Set(key, value string) error

	// Get the value of the specified key or directory.
	Get(key string, dir bool) (*KVPairs, error)

	// Watch for changes of the specified key or directory.
	Watch(key string, version uint64, dir bool) (EventChan, error)

	// Close the provider connection.
	Close()
}

Backend interface.

func BackendImplementor added in v1.1.0

func BackendImplementor() Backend

BackendImplementor returns the configuration backend service implementor.

type Bool added in v1.1.0

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

func (*Bool) AtomicUpdate added in v1.1.0

func (t *Bool) AtomicUpdate(v string)

func (*Bool) Bool added in v1.1.0

func (t *Bool) Bool() bool

func (*Bool) Changed added in v1.1.0

func (t *Bool) Changed(evt UpdateEvent)

func (*Bool) String added in v1.1.0

func (t *Bool) String() string

type Callback added in v1.1.0

type Callback interface {
	RegChan() chan<- *CallbackFunc
	EvtChan() chan<- DynamicType
}

func CallbackImplementor added in v1.1.0

func CallbackImplementor() Callback

CallbackImplementor returns the value updated callback service implementor.

type CallbackFunc added in v1.1.0

type CallbackFunc struct {
	Value DynamicType
	Event UpdateEvent
}

type Configure

type Configure interface {
	// Register the configuration pointer.
	Register(component string, v interface{}, opts ...Option) error
}

func Implementor

func Implementor() Configure

Implementor returns the configuration service implementor.

type Dialect added in v1.1.0

type Dialect interface {
	URL() string
}

type DynamicType added in v1.1.0

type DynamicType interface {
	// AtomicUpdate updates value.
	AtomicUpdate(v string)

	// Changed will be invoked if value updated.
	Changed(evt UpdateEvent)
}

DynamicType interface.

type EventChan added in v1.1.0

type EventChan chan *WatchEvent

type EventType added in v1.1.0

type EventType int
const (
	Update  EventType = iota + 1 // Key/value updated
	Delete                       // Key/value deleted
	Refresh                      // Refresh pah
)

type Float added in v1.1.0

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

func (*Float) AtomicUpdate added in v1.1.0

func (t *Float) AtomicUpdate(v string)

func (*Float) Changed added in v1.1.0

func (t *Float) Changed(evt UpdateEvent)

func (*Float) Float32 added in v1.1.0

func (t *Float) Float32() float32

func (*Float) Float64 added in v1.1.0

func (t *Float) Float64() float64

func (*Float) String added in v1.1.0

func (t *Float) String() string

type Int added in v1.1.0

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

func (*Int) AtomicUpdate added in v1.1.0

func (t *Int) AtomicUpdate(v string)

func (*Int) Changed added in v1.1.0

func (t *Int) Changed(evt UpdateEvent)

func (*Int) Int added in v1.1.0

func (t *Int) Int() int

func (*Int) Int16 added in v1.1.0

func (t *Int) Int16() int16

func (*Int) Int32 added in v1.1.0

func (t *Int) Int32() int32

func (*Int) Int64 added in v1.1.0

func (t *Int) Int64() int64

func (*Int) Int8 added in v1.1.0

func (t *Int) Int8() int8

func (*Int) String added in v1.1.0

func (t *Int) String() string

type KVPair added in v1.1.0

type KVPair struct {
	Key     string
	Value   string
	Version uint64
}

type KVPairs added in v1.1.0

type KVPairs struct {
	KVs     []*KVPair
	Version uint64
}

type Map added in v1.1.0

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

func (*Map) ArrayVal added in v1.1.0

func (t *Map) ArrayVal(key string) *embedArray

func (*Map) AtomicUpdate added in v1.1.0

func (t *Map) AtomicUpdate(v string)

func (*Map) BoolVal added in v1.1.0

func (t *Map) BoolVal(key string) *embedBool

func (*Map) Changed added in v1.1.0

func (t *Map) Changed(evt UpdateEvent)

func (*Map) FloatVal added in v1.1.0

func (t *Map) FloatVal(key string) *embedFloat

func (*Map) HasKey added in v1.1.0

func (t *Map) HasKey(key string) bool

func (*Map) IntVal added in v1.1.0

func (t *Map) IntVal(key string) *embedInt

func (*Map) Keys added in v1.1.0

func (t *Map) Keys() *embedArray

func (*Map) Len added in v1.1.0

func (t *Map) Len() int

func (*Map) MapVal added in v1.1.0

func (t *Map) MapVal(key string) *embedMap

func (*Map) String added in v1.1.0

func (t *Map) String() string

func (*Map) StringVal added in v1.1.0

func (t *Map) StringVal(key string) *embedString

func (*Map) UintVal added in v1.1.0

func (t *Map) UintVal(key string) *embedUint

type Option added in v1.1.0

type Option func(options *Options)

func WithAutoCreation added in v1.1.0

func WithAutoCreation(autoCreate bool) Option

type Options added in v1.1.0

type Options struct {
	AutoCreation bool
}

type Schema added in v1.1.0

type Schema string
const (
	SQLite     Schema = "sqlite"
	MySQL      Schema = "mysql"
	PostgreSQL Schema = "postgres"
	SQLServer  Schema = "sqlserver"
	Clickhouse Schema = "clickhouse"

	Redis        Schema = "redis"
	RedisCluster Schema = "rediscluster"

	ElasticSearch6 Schema = "elasticsearch6"
	ElasticSearch7 Schema = "elasticsearch7"

	Kafka    Schema = "kafka"
	Pulsar   Schema = "pulsar"
	RocketMQ Schema = "rocketmq"
)

type StaticType added in v1.1.0

type StaticType interface {
	// Set value.
	Set(v string)
}

StaticType interface.

type String added in v1.1.0

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

func (*String) AtomicUpdate added in v1.1.0

func (t *String) AtomicUpdate(v string)

func (*String) Changed added in v1.1.0

func (t *String) Changed(evt UpdateEvent)

func (*String) String added in v1.1.0

func (t *String) String() string

type Uint added in v1.1.0

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

func (*Uint) AtomicUpdate added in v1.1.0

func (t *Uint) AtomicUpdate(v string)

func (*Uint) Changed added in v1.1.0

func (t *Uint) Changed(evt UpdateEvent)

func (*Uint) String added in v1.1.0

func (t *Uint) String() string

func (*Uint) Uint added in v1.1.0

func (t *Uint) Uint() uint

func (*Uint) Uint16 added in v1.1.0

func (t *Uint) Uint16() uint16

func (*Uint) Uint32 added in v1.1.0

func (t *Uint) Uint32() uint32

func (*Uint) Uint64 added in v1.1.0

func (t *Uint) Uint64() uint64

func (*Uint) Uint8 added in v1.1.0

func (t *Uint) Uint8() uint8

type UpdateEvent added in v1.1.0

type UpdateEvent func()

type WatchEvent added in v1.1.0

type WatchEvent struct {
	EventType
	KVPair
}

Jump to

Keyboard shortcuts

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