Documentation
¶
Index ¶
Constants ¶
View Source
const (
// DefaultOutPath default path
DefaultOutPath = "./internal/dao/query"
)
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "gormgen", Short: "初始Gorm模板", Long: `初始Gorm模板,用来作为`, RunE: func(cmd *cobra.Command, args []string) error { return run(cmd.Context()) }, }
Cmd represents the config command
Functions ¶
This section is empty.
Types ¶
type CmdParams ¶
type CmdParams struct {
DSN string `yaml:"dsn"` // consult[https://gorm.io/docs/connecting_to_the_database.html]"
DB string `yaml:"db"` // input mysql or postgres or sqlite or sqlserver. consult[https://gorm.io/docs/connecting_to_the_database.html]
Tables []string `yaml:"tables"` // enter the required data table or leave it blank
OnlyModel bool `yaml:"onlyModel"` // only generate model
OutPath string `yaml:"outPath"` // specify a directory for output
OutFile string `yaml:"outFile"` // query code file name, default: gen.go
WithUnitTest bool `yaml:"withUnitTest"` // generate unit test for query code
ModelPkgName string `yaml:"modelPkgName"` // generated model code's package name
FieldNullable bool `yaml:"fieldNullable"` // generate with pointer when field is nullable
FieldWithIndexTag bool `yaml:"fieldWithIndexTag"` // generate field with gorm index tag
FieldWithTypeTag bool `yaml:"fieldWithTypeTag"` // generate field with gorm column type tag
FieldSignable bool `yaml:"fieldSignable"` // detect integer field's unsigned type, adjust generated data type
}
CmdParams is command line parameters
type Config ¶
type Config struct {
GenGorm YamlConfig `yaml:"genGorm"`
}
type YamlConfig ¶
type YamlConfig struct {
Version string `yaml:"version"` //
Database *CmdParams `yaml:"database"` //
}
YamlConfig is yaml config struct
Click to show internal directories.
Click to hide internal directories.