config

package
v0.0.0-...-f19dd24 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetConfig

func SetConfig(name string, config Config)

Types

type Application

type Application struct {
	Organization string `default:"dubbo-go-boot" yaml:"organization" json:"organization"`
	Name         string `default:"dubbo.io" yaml:"name" json:"name" property:"name"`
	Module       string `default:"sample" yaml:"module" json:"module"`
	Version      string `default:"1.0.0" yaml:"version" json:"version"`
	Owner        string `default:"dubbo-go" yaml:"owner" json:"owner"`
	Environment  string `default:"dev" yaml:"environment" json:"environment"`
}

func (*Application) Init

func (a *Application) Init() error

Init application config and set default value

func (*Application) Order

func (a *Application) Order() int

func (Application) Prefix

func (Application) Prefix() string

Prefix dubbo.application

type Config

type Config interface {
	// Prefix config prefix
	Prefix() string

	// Init init config
	Init() error

	// Order load order
	Order() int
}

func GetConfigs

func GetConfigs() []Config

type Database

type Database struct {
	// mongo、mysql
	Driver string `json:"driver"`

	// database url
	Url string `json:"url"`

	// database username
	Username string `yaml:"username"`

	// database password
	Password string `yaml:"password"`

	// database connect timeout
	Timeout string `default:"5s" json:"timeout"`
}

func (*Database) Init

func (d *Database) Init() error

func (*Database) InitDatabase

func (d *Database) InitDatabase(name string) error

func (*Database) Order

func (d *Database) Order() int

func (Database) Prefix

func (Database) Prefix() string

type Logger

type Logger struct {
	// log driver
	Driver string `default:"zap" json:"driver"`

	// log level
	Level string `default:"info" json:"level"`
}

func (*Logger) Init

func (l *Logger) Init() error

func (*Logger) Order

func (l *Logger) Order() int

func (*Logger) Prefix

func (l *Logger) Prefix() string

Jump to

Keyboard shortcuts

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