hotconfig

package
v2.0.51 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HotConfig

type HotConfig interface {
	GetName() string               // 获取名字
	GetValue() (any, error)        // 获取配置
	UpdateValue(data []byte) error // 更新值
}

type LoadFunction

type LoadFunction func(configName string) ([]byte, error)

type Manager

type Manager interface {
	SaveConfig(name string, data []byte) error
	LoadConfig(configName string) ([]byte, error)
	GetInstance(configName string) HotConfig
	Register(configName string, defaultConfigValue any)
}

func GetManager added in v2.0.14

func GetManager(app string, options ...Option) Manager

type Option

type Option func(*hotConfigManager)

func WithConfigStore

func WithConfigStore(configStore string) Option

func WithLoadFunction

func WithLoadFunction(fn LoadFunction) Option

func WithSaveFunction

func WithSaveFunction(fn SaveFunction) Option

type SaveFunction

type SaveFunction func(configName string, data []byte) (Transactor, error)

type Transactor

type Transactor interface {
	Commit() error
	Rollback() error
	Exec(query string, args ...interface{}) (sql.Result, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryRow(query string, args ...interface{}) *sql.Row
}

Jump to

Keyboard shortcuts

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