Documentation
¶
Index ¶
Constants ¶
View Source
const ( SnakeCase naming = "snake_case" CamelCase naming = "camelCase" PascalCase naming = "PascalCase" )
View Source
const ( DefaultConfigFile = "sqlgen.yml" DefaultGeneratedFile = "generated.go" DefaultStructTag = "sql" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Source []string `yaml:"src"` Driver SqlDriver `yaml:"driver"` NamingConvention naming `yaml:"naming_convention,omitempty"` Tag string `yaml:"struct_tag,omitempty"` // Whether to quote the table name and column name OmitQuoteIdentifier bool `yaml:"omit_quote_identifier,omitempty"` OmitGetters bool `yaml:"omit_getters,omitempty"` Strict *bool `yaml:"strict,omitempty"` Exec ExecConfig `yaml:"exec"` Getter GetterConfig `yaml:"getter"` Migration *MigrationConfig `yaml:"migration"` Database *DatabaseConfig `yaml:"database"` SourceMap bool `yaml:"source_map"` SkipHeader bool `yaml:"skip_header"` SkipModTidy bool `yaml:"skip_mod_tidy"` Models map[string]*Model `yaml:"models"` }
func DefaultConfig ¶
func DefaultConfig() *Config
func LoadConfigFrom ¶
func (Config) RenameFunc ¶
type DatabaseConfig ¶
type DatabaseConfig struct { Package string `yaml:"package"` Dir string `yaml:"dir"` Filename string `yaml:"filename"` Operator *DatabaseOperatorConfig `yaml:"operator"` }
type DatabaseOperatorConfig ¶
type ExecConfig ¶
type GetterConfig ¶
type GetterConfig struct {
Prefix string `yaml:"prefix"`
}
type MigrationConfig ¶
type MigrationConfig struct { }
type Model ¶
type Model struct { DataType string `yaml:"data_type"` Scanner string `yaml:"scan" validate:"required_with=Valuer"` SQLScanner string `yaml:"sql_scan" validate:"required_with=SQLValuer"` Valuer string `yaml:"value" validate:"required_with=Scanner"` SQLValuer string `yaml:"sql_value" validate:"required_with=SQLScanner"` }
Click to show internal directories.
Click to hide internal directories.