config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Global = &Config{}

Global global config

Functions

This section is empty.

Types

type Config

type Config struct {
	Deploy     string            `yaml:"deploy" json:"deploy" binding:"oneof=local dev debug uat prod"` // 布署环境
	Database   *Database         `yaml:"database" json:"database"`                                      // 数据库连接信息
	OutDir     string            `yaml:"outDir" json:"outDir" binding:"required"`                       // 文件输出路径
	TypeDefine map[string]string `yaml:"typeDefine" json:"typeDefine"`                                  // 自定义数据类型
	TableNames []string          `yaml:"tableNames" json:"tableNames"`                                  // 指定输出表
	View       view.Config       `yaml:"view" json:"view"`
}

Config custom config

func (*Config) Load added in v0.1.1

func (cc *Config) Load() error

type Database

type Database struct {
	Dialect  string `yaml:"dialect" json:"dialect" binding:"oneof=mysql sqlite3"` // mysql, sqlite3
	Host     string `yaml:"host" json:"host" binding:"required"`                  // Host. 地址
	Port     int    `yaml:"port" json:"port" binding:"required"`                  // Port 端口号
	Username string `yaml:"username" json:"username" binding:"required"`          // Username 用户名
	Password string `yaml:"password" json:"password" binding:"required"`          // Password 密码
	Db       string `yaml:"db" json:"db" binding:"required"`                      // Database 数据库名
	Options  string `yaml:"options" json:"options"`                               // Options ?号后面, 如果为空, 则为 charset=utf8mb4&parseTime=True&loc=Local&interpolateParams=True
	// contains filtered or unexported fields
}

Database connect information

func (*Database) DbName

func (c *Database) DbName() string

func (*Database) Dsn

func (c *Database) Dsn() string

func (*Database) Parse

func (c *Database) Parse() error

Jump to

Keyboard shortcuts

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