Documentation ¶
Index ¶
- Constants
- func GetExtName(fileName string) string
- func GetLevelString(lvl log.LogLevel) string
- func GetPresetTemplate(name string) *template.Template
- func LoadDataFile(data interface{}, fileName string) error
- func MarshalFile(marshal MarshalFunc, data interface{}, fileName string) error
- func NewTemplate(name, content string, funcs template.FuncMap) *template.Template
- func RegisterLanguage(l *Language)
- func SaveDataFile(data interface{}, fileName string) error
- func UnmarshalFile(unmarshal UnmarshalFunc, data interface{}, fileName string) error
- type Configure
- func (cfg *Configure) Autofix(params map[string]interface{}, err error) error
- func (cfg Configure) GetConnConfig(key string) (ConnConfig, bool)
- func (cfg Configure) GetConnConfigMap(keys ...string) map[string]ConnConfig
- func (cfg Configure) GetReverseTarget(name string) ReverseTarget
- func (cfg *Configure) RemovePrivates()
- type ConnConfig
- type Formatter
- type IConfigure
- type IReverseConfig
- type Importter
- type Language
- type MarshalFunc
- type Packager
- type ReverseSource
- type ReverseTarget
- func (t ReverseTarget) GetFileName(dir, name string) string
- func (t ReverseTarget) GetOutFileName(name string) string
- func (t ReverseTarget) GetParentOutDir(backward int) string
- func (t ReverseTarget) GetParentOutFileName(name string, backward int) string
- func (t ReverseTarget) RegularizeOptions(key string, src *ReverseSource) ReverseTarget
- type SqlLogger
- type UnmarshalFunc
Constants ¶
View Source
const ( INIT_FILE_NAME = "init" CONN_FILE_NAME = "conn" SINGLE_FILE_NAME = "models" QUERY_FILE_NAME = "queries" )
Variables ¶
This section is empty.
Functions ¶
func GetPresetTemplate ¶ added in v2.0.3
func MarshalFile ¶
func MarshalFile(marshal MarshalFunc, data interface{}, fileName string) error
func NewTemplate ¶ added in v2.0.3
func RegisterLanguage ¶ added in v2.0.3
func RegisterLanguage(l *Language)
RegisterLanguage registers a language
func UnmarshalFile ¶
func UnmarshalFile(unmarshal UnmarshalFunc, data interface{}, fileName string) error
Types ¶
type Configure ¶
type Configure struct { Connections map[string]ConnConfig `json:"connections" yaml:"connections" toml:"connections"` ReverseTarget ReverseTarget `json:"reverse_target" yaml:"reverse_target" toml:"reverse_target"` Extras map[string]interface{} `json:"extras,omitempty" yaml:"extras,omitempty" toml:"extras"` }
func ReadSettings ¶
func (Configure) GetConnConfig ¶
func (cfg Configure) GetConnConfig(key string) (ConnConfig, bool)
func (Configure) GetConnConfigMap ¶
func (cfg Configure) GetConnConfigMap(keys ...string) map[string]ConnConfig
func (Configure) GetReverseTarget ¶
func (cfg Configure) GetReverseTarget(name string) ReverseTarget
func (*Configure) RemovePrivates ¶
func (cfg *Configure) RemovePrivates()
type ConnConfig ¶
type ConnConfig struct { DriverName string `json:"driver_name" yaml:"driver_name" toml:"driver_name"` TablePrefix string `json:"table_prefix,omitempty" yaml:"table_prefix,omitempty" toml:"table_prefix"` LogFile string `json:"log_file,omitempty" yaml:"log_file,omitempty" toml:"log_file"` Params dialect.ConnParams `json:"params" yaml:"params" toml:"params"` }
func (ConnConfig) ConnectRedis ¶
func (c ConnConfig) ConnectRedis(verbose bool) (redis.Conn, error)
func (ConnConfig) ConnectXorm ¶
func (c ConnConfig) ConnectXorm(verbose bool) (*xorm.Engine, error)
type IConfigure ¶ added in v2.0.4
type IReverseConfig ¶
type IReverseConfig interface { GetReverseTarget(name string) ReverseTarget GetConnConfigMap(keys ...string) map[string]ConnConfig GetConnConfig(key string) (ConnConfig, bool) }
type Language ¶ added in v2.0.3
type Language struct { Name string ExtName string Template string Types map[string]string Funcs template.FuncMap Formatter Formatter Importter Importter Packager Packager }
Language represents a languages supported when reverse codes
func GetLanguage ¶ added in v2.0.3
GetLanguage returns a language if exists
func (*Language) FixTarget ¶ added in v2.0.3
func (l *Language) FixTarget(target *ReverseTarget)
type MarshalFunc ¶
type ReverseSource ¶
type ReverseSource struct { DriverName string `json:"driver_name" yaml:"driver_name" toml:"driver_name"` TablePrefix string `json:"table_prefix,omitempty" yaml:"table_prefix,omitempty" toml:"table_prefix"` ImporterPath string `json:"importer_path,omitempty" yaml:"importer_path,omitempty" toml:"importer_path"` ConnStr string `json:"conn_str" yaml:"conn_str" toml:"conn_str"` OptStr string `json:"opt_str,omitempty" yaml:"opt_str,omitempty" toml:"opt_str"` // contains filtered or unexported fields }
ReverseSource represents a reverse source which should be a database connection
func NewReverseSource ¶
func NewReverseSource(c ConnConfig) (*ReverseSource, dialect.Dialect)
type ReverseTarget ¶
type ReverseTarget struct { Language string `json:"language" yaml:"language" toml:"language"` IncludeTables []string `json:"include_tables" yaml:"include_tables" toml:"include_tables"` ExcludeTables []string `json:"exclude_tables" yaml:"exclude_tables" toml:"exclude_tables"` InitNameSpace string `json:"init_name_space" yaml:"init_name_space" toml:"init_name_space"` OutputDir string `json:"output_dir" yaml:"output_dir" toml:"output_dir"` TemplatePath string `json:"template_path" yaml:"template_path" toml:"template_path"` QueryTemplatePath string `json:"query_template_path,omitempty" yaml:"query_template_path,omitempty" toml:"query_template_path"` InitTemplatePath string `json:"init_template_path,omitempty" yaml:"init_template_path,omitempty" toml:"init_template_path"` TableMapper string `json:"table_mapper,omitempty" yaml:"table_mapper,omitempty" toml:"table_mapper"` ColumnMapper string `json:"column_mapper,omitempty" yaml:"column_mapper,omitempty" toml:"column_mapper"` Funcs map[string]string `json:"funcs,omitempty" yaml:"funcs,omitempty" toml:"funcs"` Formatter string `json:"formatter,omitempty" yaml:"formatter,omitempty,omitempty" toml:"formatter"` Importter string `json:"importter,omitempty" yaml:"importter,omitempty,omitempty" toml:"importter"` ExtName string `json:"-" yaml:"-" toml:"-"` NameSpace string `json:"-" yaml:"-" toml:"-"` MultipleFiles bool `json:"multiple_files" yaml:"multiple_files" toml:"multiple_files"` ApplyMixins bool `json:"apply_mixins" yaml:"apply_mixins" toml:"apply_mixins"` MixinDirPath string `json:"mixin_dir_path,omitempty" yaml:"mixin_dir_path,omitempty" toml:"mixin_dir_path"` MixinNameSpace string `json:"mixin_name_space,omitempty" yaml:"mixin_name_space,omitempty" toml:"mixin_name_space"` }
ReverseTarget represents a reverse target
func DefaultMixinReverseTarget ¶
func DefaultMixinReverseTarget(nameSpace string) ReverseTarget
func DefaultReverseTarget ¶
func DefaultReverseTarget(nameSpace string) ReverseTarget
func (ReverseTarget) GetFileName ¶
func (t ReverseTarget) GetFileName(dir, name string) string
func (ReverseTarget) GetOutFileName ¶
func (t ReverseTarget) GetOutFileName(name string) string
func (ReverseTarget) GetParentOutDir ¶
func (t ReverseTarget) GetParentOutDir(backward int) string
func (ReverseTarget) GetParentOutFileName ¶
func (t ReverseTarget) GetParentOutFileName(name string, backward int) string
func (ReverseTarget) RegularizeOptions ¶
func (t ReverseTarget) RegularizeOptions(key string, src *ReverseSource) ReverseTarget
type UnmarshalFunc ¶
Click to show internal directories.
Click to hide internal directories.