config

package
v0.0.0-...-5cf9733 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfEnv string

Functions

This section is empty.

Types

type CacheInterface

type CacheInterface interface {
	CommonInterface
	FuzzyDelete(keyPre string)
}

CacheInterface cache interface

type CommonInterface

type CommonInterface interface {
	Get(key string) any
	Set(key string, value any) bool
	Has(key string) bool
}

CommonInterface ...

type Config

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

func New

func New(config CommonInterface, option Options) (provider *Config, err error)

func (*Config) Get

func (c *Config) Get(key string) any

func (*Config) GetBool

func (c *Config) GetBool(key string) bool

func (*Config) GetDuration

func (c *Config) GetDuration(key string) time.Duration

func (*Config) GetFloat64

func (c *Config) GetFloat64(key string) float64

func (*Config) GetInt

func (c *Config) GetInt(key string) int

func (*Config) GetInt32

func (c *Config) GetInt32(key string) int32

func (*Config) GetInt64

func (c *Config) GetInt64(key string) int64

func (*Config) GetString

func (c *Config) GetString(key string) string

func (*Config) GetStringMap

func (c *Config) GetStringMap(key string) map[string]any

func (*Config) GetStringSlice

func (c *Config) GetStringSlice(key string) []string

type Interface

type Interface interface {
	Get(key string) any
	GetString(key string) string
	GetBool(key string) bool
	GetInt(key string) int
	GetInt32(key string) int32
	GetInt64(key string) int64
	GetFloat64(key string) float64
	GetDuration(key string) time.Duration
	GetStringSlice(key string) []string
	GetStringMap(key string) map[string]any
}

Interface cache interface

type Options

type Options struct {
	FileName    string         // file name
	BasePath    string         // base path
	Ctype       string         // type of config file
	CachePrefix string         // cache prefix
	Cache       CacheInterface // Configure the register to customize the register, such as using redis You only need to implement the CacheInterface interface
}

Options 配置选项

type Viper

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

func NewViper

func NewViper() *Viper

func (*Viper) Apply

func (v *Viper) Apply(option Options) error

Apply 创建实例

func (*Viper) Get

func (v *Viper) Get(key string) any

func (*Viper) Has

func (v *Viper) Has(key string) bool

func (*Viper) Set

func (v *Viper) Set(key string, value any) bool

Jump to

Keyboard shortcuts

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