config

package
v0.0.1-rc13 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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

type Database

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

Database connect information

func (*Database) GetDbDSNAndDbName

func (c *Database) GetDbDSNAndDbName() (dsn, db string, err error)

Jump to

Keyboard shortcuts

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