toybox

package module
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 2

README

toybox

a scaffolding project


Documentation

Index

Constants

View Source
const (
	Toml = "toml"
	Yaml = "yaml"
	Json = "json"
)
View Source
const Version = "v1.2.2"

Variables

This section is empty.

Functions

func GetBool

func GetBool(key string) bool

func GetFloat

func GetFloat(key string) float64

func GetInt

func GetInt(key string) int

func GetString

func GetString(key string) string

func GetStringSlice

func GetStringSlice(key string) []string

Types

type Component

type Component interface {
	Init(ctx context.Context) error
	// contains filtered or unexported methods
}

type Conf

type Conf interface {
	Path() string
	Pattern() string
	SetConfig(cfg string)
	Decode() error
	GetBaseConf() map[string]interface{}
}

type ConfWithToml

type ConfWithToml struct {
	ConfDir string
	Env     string
	// contains filtered or unexported fields
}

func (*ConfWithToml) Decode

func (conf *ConfWithToml) Decode() error

func (*ConfWithToml) GetBaseConf

func (conf *ConfWithToml) GetBaseConf() map[string]interface{}

func (*ConfWithToml) Path

func (conf *ConfWithToml) Path() string

func (*ConfWithToml) Pattern

func (conf *ConfWithToml) Pattern() string

func (*ConfWithToml) PrimitiveDecodeComponent

func (conf *ConfWithToml) PrimitiveDecodeComponent(cpts ...Component) error

func (*ConfWithToml) PrimitiveDecodeServer

func (conf *ConfWithToml) PrimitiveDecodeServer(svrs ...Server) error

func (*ConfWithToml) SetConfig

func (conf *ConfWithToml) SetConfig(cfg string)

type ConfigMate

type ConfigMate interface {
	PrimitiveDecodeComponent(cpts ...Component) error
	PrimitiveDecodeServer(svrs ...Server) error
}

func GetConfMate

func GetConfMate() ConfigMate

func NewConfig

func NewConfig() ConfigMate

type Option

type Option func(*ToyBox)

func WithConfigMate

func WithConfigMate(mate ConfigMate) Option

func WithLoadConf

func WithLoadConf(cfgs ...SetConfig) Option

type Server

type Server interface {
	Run(ctx context.Context) error
	// contains filtered or unexported methods
}

type SetConfig

type SetConfig struct {
	ConfDir  string
	Env      string
	FileType string
}

type ToyBox

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

func New

func New(opts ...Option) *ToyBox

func (*ToyBox) AppendComponent

func (tb *ToyBox) AppendComponent(cpts ...Component)

func (*ToyBox) AppendServer

func (tb *ToyBox) AppendServer(svcs ...Server)

func (*ToyBox) ID

func (tb *ToyBox) ID() string

func (*ToyBox) Run

func (tb *ToyBox) Run() error

Jump to

Keyboard shortcuts

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