dync

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package dync provide dynamic property supported.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array[T any] struct {
	// contains filtered or unexported fields
}

func (*Array[T]) MarshalJSON

func (x *Array[T]) MarshalJSON() ([]byte, error)

func (*Array[T]) OnRefresh

func (x *Array[T]) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Array[T]) Store

func (x *Array[T]) Store(v []T)

Store atomically stores val.

func (*Array[T]) Value

func (x *Array[T]) Value() []T

Value returns the stored []T value.

type Bool

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

A Bool is an atomic bool value that can be dynamic refreshed.

func (*Bool) MarshalJSON

func (x *Bool) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of x.

func (*Bool) OnRefresh

func (x *Bool) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Bool) Store

func (x *Bool) Store(v bool)

Store atomically stores val.

func (*Bool) Value

func (x *Bool) Value() bool

Value returns the stored bool value.

type Duration

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

A Duration is an atomic time.Duration value that can be dynamic refreshed.

func (*Duration) MarshalJSON

func (x *Duration) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of x.

func (*Duration) OnRefresh

func (x *Duration) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Duration) Store

func (x *Duration) Store(v time.Duration)

Store atomically stores val.

func (*Duration) Value

func (x *Duration) Value() time.Duration

Value returns the stored time.Duration value.

type Field

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

A Field represents a refreshable struct field.

type Float32

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

A Float32 is an atomic float32 value that can be dynamic refreshed.

func (*Float32) MarshalJSON

func (x *Float32) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of x.

func (*Float32) OnRefresh

func (x *Float32) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Float32) Store

func (x *Float32) Store(v float32)

Store atomically stores val.

func (*Float32) Value

func (x *Float32) Value() float32

Value returns the stored float32 value.

type Float64

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

A Float64 is an atomic float64 value that can be dynamic refreshed.

func (*Float64) MarshalJSON

func (x *Float64) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of x.

func (*Float64) OnRefresh

func (x *Float64) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Float64) Store

func (x *Float64) Store(v float64)

Store atomically stores val.

func (*Float64) Value

func (x *Float64) Value() float64

Value returns the stored float64 value.

type Int32

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

An Int32 is an atomic int32 value that can be dynamic refreshed.

func (*Int32) MarshalJSON

func (x *Int32) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of x.

func (*Int32) OnRefresh

func (x *Int32) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Int32) Store

func (x *Int32) Store(v int32)

Store atomically stores val.

func (*Int32) Value

func (x *Int32) Value() int32

Value returns the stored int32 value.

type Int64

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

An Int64 is an atomic int64 value that can be dynamic refreshed.

func (*Int64) MarshalJSON

func (x *Int64) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of x.

func (*Int64) OnRefresh

func (x *Int64) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Int64) Store

func (x *Int64) Store(v int64)

Store atomically stores val.

func (*Int64) Value

func (x *Int64) Value() int64

Value returns the stored int64 value.

type Map

type Map[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*Map[K, V]) MarshalJSON

func (x *Map[K, V]) MarshalJSON() ([]byte, error)

func (*Map[K, V]) OnRefresh

func (x *Map[K, V]) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Map[K, V]) Store

func (x *Map[K, V]) Store(v map[K]V)

Store atomically stores val.

func (*Map[K, V]) Value

func (x *Map[K, V]) Value() map[K]V

Value returns the stored map[K]V value.

type Properties

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

Properties refreshes registered fields dynamically and concurrently.

func New

func New() *Properties

New returns a Properties.

func (*Properties) Bind

func (p *Properties) Bind(i interface{}, args ...conf.BindArg) error

Bind binds properties to a value.

func (*Properties) BindValue

func (p *Properties) BindValue(v reflect.Value, param conf.BindParam) error

BindValue binds properties to a value.

func (*Properties) Get

func (p *Properties) Get(key string, opts ...conf.GetOption) string

Get returns key's value.

func (*Properties) Has

func (p *Properties) Has(key string) bool

Has returns whether key exists.

func (*Properties) Keys

func (p *Properties) Keys() []string

Keys returns all sorted keys.

func (*Properties) Refresh

func (p *Properties) Refresh(prop *conf.Properties) (err error)

Refresh refreshes new Properties atomically.

func (*Properties) Remove

func (p *Properties) Remove(key string) error

Remove delete key from properties.

func (*Properties) Resolve

func (p *Properties) Resolve(s string) (string, error)

Resolve resolves string value.

func (*Properties) Set

func (p *Properties) Set(key, value string) error

Set refresh properties value by key.

type String

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

A String is an atomic string value that can be dynamic refreshed.

func (*String) MarshalJSON

func (x *String) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of x.

func (*String) OnRefresh

func (x *String) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*String) Store

func (x *String) Store(v string)

Store atomically stores val.

func (*String) Value

func (x *String) Value() string

Value returns the stored string value.

type Time

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

A Time is an atomic time.Time value that can be dynamic refreshed.

func (*Time) MarshalJSON

func (x *Time) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of x.

func (*Time) OnRefresh

func (x *Time) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Time) Store

func (x *Time) Store(v time.Time)

Store atomically stores val.

func (*Time) Value

func (x *Time) Value() time.Time

Value returns the stored time.Time value.

type Uint32

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

An Uint32 is an atomic uint32 value that can be dynamic refreshed.

func (*Uint32) MarshalJSON

func (x *Uint32) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of x.

func (*Uint32) OnRefresh

func (x *Uint32) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Uint32) Store

func (x *Uint32) Store(v uint32)

Store atomically stores val.

func (*Uint32) Value

func (x *Uint32) Value() uint32

Value returns the stored uint32 value.

type Uint64

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

An Uint64 is an atomic uint64 value that can be dynamic refreshed.

func (*Uint64) MarshalJSON

func (x *Uint64) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of x.

func (*Uint64) OnRefresh

func (x *Uint64) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Uint64) Store

func (x *Uint64) Store(v uint64)

Store atomically stores val.

func (*Uint64) Value

func (x *Uint64) Value() uint64

Value returns the stored uint64 value.

type Value

type Value[T any] struct {
	// contains filtered or unexported fields
}

func (*Value[T]) MarshalJSON

func (x *Value[T]) MarshalJSON() ([]byte, error)

func (*Value[T]) OnRefresh

func (x *Value[T]) OnRefresh(p *conf.Properties, param conf.BindParam) error

OnRefresh refreshes the stored value.

func (*Value[T]) Store

func (x *Value[T]) Store(v *T)

Store atomically stores val.

func (*Value[T]) Value

func (x *Value[T]) Value() *T

Value returns the stored value.

Jump to

Keyboard shortcuts

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