config

package
v0.0.0-...-a30d4c3 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrap

type Bootstrap struct {
	Package string `toml:"package" json:"package"` // 包名
	Import  string `toml:"import" json:"import"`   // 导入包路径
	Enabled bool   `toml:"enabled" json:"enabled"` // 是否允许生成
	// Server     bool   `toml:"server" json:"server"`         // 服务主程序
	// Router     bool   `toml:"router" json:"router"`         // 路由
	// Controller bool   `toml:"controller" json:"controller"` // 控制器
	// Middleware bool   `toml:"middleware" json:"middleware"` // 中间件
	// Global     bool   `toml:"global" json:"global"`         // 全局处理程序
	Template string `toml:"template" json:"template"` // 模板名称
}

Bootstrap 程序框架生成配置

type Column

type Column struct {
	Alias string `toml:"alias,omitempty" json:"alias,omitempty"` // 列别名
	Type  string `toml:"type,omitempty" json:"type,omitempty"`   // 列自字义类型
}

Column 列

type Config

type Config struct {
	Debug     bool             `toml:"debug,omitempty" json:"debug,omitempty"`
	Prefix    string           `toml:"prefix" json:"prefix"`
	Suffix    string           `toml:"suffix" json:"suffix"`
	DB        DB               `toml:"db" json:"db"`
	Tables    map[string]Table `toml:"tables,omitempty" json:"tables,omitempty"`
	Model     Model            `toml:"model" json:"model"`
	Query     Query            `toml:"query" json:"query"`
	Service   Service          `toml:"service" json:"service"`
	Bootstrap Bootstrap        `toml:"bootstrap" json:"bootstrap"`
}

Config for the running of the commands

type DB

type DB struct {
	Name      string   `toml:"name" json:"name"`
	Host      string   `toml:"host" json:"host"`
	Port      int      `toml:"port" json:"port"`
	User      string   `toml:"user" json:"user"`
	Pass      string   `toml:"pass" json:"pass"`
	SSLMode   string   `toml:"ssl_mode" json:"ssl_mode"`
	Whitelist []string `toml:"whitelist" json:"whitelist"`
	Blacklist []string `toml:"blacklist" json:"blacklist"`
}

func (*DB) GetConnStr

func (d *DB) GetConnStr() string

func (*DB) GetTables

func (d *DB) GetTables(db *sql.DB) []string

type Model

type Model struct {
	Package  string   `toml:"package" json:"package"`   // 包名
	Import   string   `toml:"import" json:"import"`     // 导入包路径
	Enabled  bool     `toml:"enabled" json:"enabled"`   // 是否允许生成
	Base     bool     `toml:"base" json:"base"`         // 是否生成基础模型
	Guregu   bool     `toml:"guregu" json:"guregu"`     // 是否使用guregu/null类型包
	Tags     []string `toml:"tags" json:"tags"`         // 模型标记
	Template string   `toml:"template" json:"template"` // 模板名称
}

Model 模型生成配置

type Query

type Query struct {
	Package  string `toml:"package" json:"package"`   // 包名
	Import   string `toml:"import" json:"import"`     // 导入包路径
	Enabled  bool   `toml:"enabled" json:"enabled"`   // 是否允许生成
	Base     bool   `toml:"base" json:"base"`         // 是否生成基础查询结构
	Template string `toml:"template" json:"template"` // 模板名称
}

Query 查询生成配置

type Service

type Service struct {
	Package   string `toml:"package" json:"package"`     // 包名
	Enabled   bool   `toml:"enabled" json:"enabled"`     // 是否允许生成
	Interface bool   `toml:"interface" json:"interface"` // 是否生成接口
	Template  string `toml:"template" json:"template"`   // 模板名称
}

Service 服务生成配置

type Table

type Table struct {
	Aliases map[string]TableAlias `toml:"aliases,omitempty" json:"aliases,omitempty"`
	Columns map[string]Column     `toml:"columns,omitempty" json:"columns,omitempty"`
}

type TableAlias

type TableAlias struct {
	UpPlural     string `toml:"up_plural,omitempty" json:"up_plural,omitempty"`
	UpSingular   string `toml:"up_singular,omitempty" json:"up_singular,omitempty"`
	DownPlural   string `toml:"down_plural,omitempty" json:"down_plural,omitempty"`
	DownSingular string `toml:"down_singular,omitempty" json:"down_singular,omitempty"`
}

TableAlias defines the spellings for a table name in Go

Jump to

Keyboard shortcuts

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