configure

package module
v0.0.0-...-8679215 Latest Latest
Warning

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

Go to latest
Published: May 9, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

README

configure

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configure

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

func New

func New(driver Driver, opts ...Option) (*Configure, error)

func (*Configure) Close

func (conf *Configure) Close()

func (*Configure) Listen

func (conf *Configure) Listen(units ...Unit) (err error)

type Context

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

func (*Context) HotUpgrade

func (ctx *Context) HotUpgrade(key string, buf []byte)

func (*Context) Scheme

func (ctx *Context) Scheme(key string) KV

func (*Context) Schemes

func (ctx *Context) Schemes() map[string]KV

type Driver

type Driver interface {
	Name() string
	Listen(ctx *Context) error
	Get(key string, schemes KV) ([]byte, error)
	Close()
}

type JsonParser

type JsonParser struct{}

func (*JsonParser) Marshal

func (p *JsonParser) Marshal(value any) ([]byte, error)

func (*JsonParser) Unmarshal

func (p *JsonParser) Unmarshal(config any, buf []byte) error

type KV

type KV map[string]any

type Option

type Option func(*Configure) error

func FirstIgnoreError

func FirstIgnoreError() Option

func WithOtherDrivers

func WithOtherDrivers(drivers ...Driver) Option

type Parser

type Parser interface {
	Marshal(value any) ([]byte, error)
	Unmarshal(config any, buf []byte) error
}
var (
	Json Parser = new(JsonParser)
	Yaml Parser = new(YamlParser)
	Xml  Parser = new(XmlParser)
)

type Unit

type Unit interface {
	Option() *UnitOption
	PreUnits() []string
	Slot() any
}

type UnitOption

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

func NewOption

func NewOption(key string, parser Parser) *UnitOption

func (*UnitOption) HotUpgrade

func (opt *UnitOption) HotUpgrade(allow bool) *UnitOption

func (*UnitOption) WithDriverName

func (opt *UnitOption) WithDriverName(name string) *UnitOption

func (*UnitOption) WithHotUpgradeErrorFunc

func (opt *UnitOption) WithHotUpgradeErrorFunc(fn func(err error)) *UnitOption

func (*UnitOption) WithScheme

func (opt *UnitOption) WithScheme(key string, value any) *UnitOption

func (*UnitOption) WithSchemes

func (opt *UnitOption) WithSchemes(schemes KV) *UnitOption

func (*UnitOption) WithSlotAfterCallback

func (opt *UnitOption) WithSlotAfterCallback(fn func() error, useToInit bool) *UnitOption

func (*UnitOption) WithSlotBeforeCallback

func (opt *UnitOption) WithSlotBeforeCallback(fn func() error, useToInit bool) *UnitOption

func (*UnitOption) WithThreadSafe

func (opt *UnitOption) WithThreadSafe(locker sync.Locker) *UnitOption

type XmlParser

type XmlParser struct{}

func (*XmlParser) Marshal

func (p *XmlParser) Marshal(value any) ([]byte, error)

func (*XmlParser) Unmarshal

func (p *XmlParser) Unmarshal(config any, buf []byte) error

type YamlParser

type YamlParser struct{}

func (*YamlParser) Marshal

func (p *YamlParser) Marshal(value any) ([]byte, error)

func (*YamlParser) Unmarshal

func (p *YamlParser) Unmarshal(config any, buf []byte) error

Directories

Path Synopsis
dirver
dir

Jump to

Keyboard shortcuts

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