Documentation
¶
Index ¶
- func CreateDirectory(dirName string) error
- func CreateTestDatabase() *memory.Database
- func GetModelPackageName(outpath string) string
- func GetModelPath(outpath string) string
- func InitConfig(opts ...ConfigOptionFunc)
- func Keys(t interface{}, exclude []string) []string
- func NewConfigFromReader(in io.Reader, cType string) *viper.Viper
- func NewDB(vip *viper.Viper) *sql.DB
- func ProviderConfig(in io.Reader, cType string) *viper.Viper
- func ProviderDB(vip *viper.Viper) *sql.DB
- type Callback
- type ColumnMeta
- type ConfigOption
- type ConfigOptionFunc
- type FieldMapping
- type MappingFile
- type TableMeta
- func (self *TableMeta) BuildModel() *jen.File
- func (self *TableMeta) BuildName(name string) *TableMeta
- func (self *TableMeta) BuildPrefix(prefix string) *TableMeta
- func (self *TableMeta) BuildRepo() *jen.File
- func (self *TableMeta) GetAllColumnMeta() ([]*ColumnMeta, error)
- func (self *TableMeta) GetFileName(modulePath string, genre string) string
- func (self *TableMeta) GetGoFileName() string
- func (self *TableMeta) GetModelName() string
- func (self *TableMeta) GetModelNameAsVariable() string
- func (self *TableMeta) GetModuleName() string
- func (self *TableMeta) GetModulePath(base string) string
- func (self *TableMeta) GetNameWithoutPrefix() string
- func (self *TableMeta) SaveModel(modulePath string) error
- func (self *TableMeta) SaveRepo(modulePath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDirectory ¶
func CreateTestDatabase ¶
func GetModelPackageName ¶
func GetModelPath ¶
func InitConfig ¶
func InitConfig(opts ...ConfigOptionFunc)
Types ¶
type ColumnMeta ¶
type ColumnMeta struct { FieldMapping Column *sql.ColumnType }
func (*ColumnMeta) GenerateGo ¶
func (self *ColumnMeta) GenerateGo(group *jen.Group)
func (*ColumnMeta) GetGoName ¶
func (self *ColumnMeta) GetGoName() string
func (*ColumnMeta) GetJsonName ¶
func (self *ColumnMeta) GetJsonName() string
func (*ColumnMeta) GetName ¶
func (self *ColumnMeta) GetName() string
func (*ColumnMeta) GetSqlType ¶
func (self *ColumnMeta) GetSqlType() string
func (*ColumnMeta) ParseAllTypes ¶
func (self *ColumnMeta) ParseAllTypes(maps []*FieldMapping)
type ConfigOptionFunc ¶
type ConfigOptionFunc func(opts *ConfigOption)
func WithV ¶
func WithV(v bool) ConfigOptionFunc
func WithVV ¶
func WithVV(vv bool) ConfigOptionFunc
func WithVVV ¶
func WithVVV(vvv bool) ConfigOptionFunc
func WithVVVV ¶
func WithVVVV(vvvv bool) ConfigOptionFunc
type FieldMapping ¶
type FieldMapping struct { SqlType string `json:"sql_type" deepcopier:"field:SqlType"` GoType string `json:"go_type" deepcopier:"field:GoType"` JsonType string `json:"json_type" deepcopier:"field:JsonType"` ProtobufType string `json:"protobuf_type" deepcopier:"field:ProtobufType"` GureguType string `json:"guregu_type" deepcopier:"field:GureguType"` GoNullableType string `json:"go_nullable_type" deepcopier:"field:GoNullableType"` SwaggerType string `json:"swagger_type" deepcopier:"field:SwaggerType"` Size int `json:"size,omitempty"` Custom string `json:"custom,omitempty"` }
type MappingFile ¶
type MappingFile struct {
Mappings []*FieldMapping `json:"mappings"`
}
func NewMappingFromJSON ¶
func NewMappingFromJSON(filename string) (*MappingFile, error)
type TableMeta ¶
type TableMeta struct { Columns []*ColumnMeta Name string Prefix string PrimaryColumn *ColumnMeta OutputPath string // contains filtered or unexported fields }
func (*TableMeta) BuildModel ¶
func (*TableMeta) BuildPrefix ¶
func (*TableMeta) GetAllColumnMeta ¶
func (self *TableMeta) GetAllColumnMeta() ([]*ColumnMeta, error)
func (*TableMeta) GetFileName ¶
func (*TableMeta) GetGoFileName ¶
func (*TableMeta) GetModelName ¶
func (*TableMeta) GetModelNameAsVariable ¶
func (*TableMeta) GetModuleName ¶
func (*TableMeta) GetModulePath ¶
func (*TableMeta) GetNameWithoutPrefix ¶
Click to show internal directories.
Click to hide internal directories.