configx

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPath = "conf/table.yaml"
View Source
var TableConfigs = new(config)

Functions

func GetConfig

func GetConfig() *config

func Init

func Init()

func LoadConfigFromYaml

func LoadConfigFromYaml(configPath string)

func ParseConfigByViper

func ParseConfigByViper(configPath, configName, configType string)

Types

type DBTableInfo

type DBTableInfo struct {
	DBName         string       `json:"db_name" yaml:"db_name"`
	DBType         string       `json:"db_type" yaml:"db_type"`
	DSN            string       `json:"dsn" yaml:"dsn"`
	OnlyModel      bool         `json:"only_model" yaml:"only_model"`
	GenHook        bool         `json:"gen_hook" yaml:"gen_hook"`
	ServicePath    string       `json:"service_path" yaml:"service_path"`
	ModelPath      string       `json:"model_path" yaml:"model_path"`
	DaoPath        string       `json:"dao_path" yaml:"dao_path"`
	UseSQLNullable bool         `json:"use_sql_nullable" yaml:"use_sql_nullable"`
	Tables         []*TableInfo `json:"tables" yaml:"tables"`

	ModelModule string
	DaoModule   string
	// DSN 可选
	Host     string `json:"host" yaml:"host"`
	Port     int    `json:"port" yaml:"port"`
	User     string `json:"user" yaml:"user"`
	Password string `json:"password" yaml:"password"`
	Database string `json:"database" yaml:"database"`
}

DBTableInfo 连接配置

func (*DBTableInfo) GenDSN

func (c *DBTableInfo) GenDSN() (dsn string)

type TableInfo

type TableInfo struct {
	SchemaName string   `json:"schema_name" yaml:"schema_name"`
	TableList  []string `json:"table_list" yaml:"table_list"`
}

TableInfo 连接配置

Jump to

Keyboard shortcuts

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