Documentation
¶
Index ¶
- func DoubleSlashComment(f string) string
- func ExecCommand(t TmplCtx, q Query) string
- func Format(s string) string
- func Imports(filename string, pkgName string) []string
- func LowerTitle(f string) string
- func Offset(v int) int
- type Config
- type Constant
- type Enum
- type Field
- type Importer
- type Params
- type Query
- type QueryValue
- type Struct
- type TmplCtx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoubleSlashComment ¶
func ExecCommand ¶
func LowerTitle ¶
Types ¶
type Config ¶
type Config struct {
Package string `json:"namespace"`
EmitExactTableNames bool `json:"emit_exact_table_names"`
Async bool `json:"async"`
EmitClasses bool `json:"emit_classes"`
TypeAffinity bool `json:"type_affinity" default:"true"`
InflectionExcludeTableNames []string `json:"inflection_exclude_table_names"`
}
func (Config) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Config) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Config) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Config) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Enum ¶
func BuildEnums ¶
func BuildEnums(req *plugin.CodeGenRequest) []Enum
type Importer ¶
type Importer struct {
Settings *plugin.Settings
DataClasses []Struct
Enums []Enum
Queries []Query
}
var DefaultImporter *Importer
type Query ¶
type Query struct {
ClassName string
Cmd string
Comments []string
MethodName string
FieldName string
ConstantName string
SQL string
SourceName string
Ret QueryValue
Arg Params
}
A struct used to generate methods and fields on the Queries struct
func BuildQueries ¶
func BuildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error)
type QueryValue ¶
func (QueryValue) EmitStruct ¶
func (v QueryValue) EmitStruct() bool
func (QueryValue) IsStruct ¶
func (v QueryValue) IsStruct() bool
func (QueryValue) Type ¶
func (v QueryValue) Type() string
type Struct ¶
type Struct struct {
Table plugin.Identifier
Name string
Fields []Field
Comment string
}
func BuildDataClasses ¶
func BuildDataClasses(conf Config, req *plugin.CodeGenRequest) []Struct
type TmplCtx ¶
type TmplCtx struct {
Q string
Package string
Enums []Enum
DataClasses []Struct
Queries []Query
Settings *plugin.Settings
SqlcVersion string
// TODO: Race conditions
SourceName string
Configuration Config
EmitJSONTags bool
EmitPreparedQueries bool
EmitInterface bool
}
func (TmplCtx) ConnPipeline ¶
provide initial connection string
func (TmplCtx) ConnString ¶
provide initial connection string
func (TmplCtx) ExtraModels ¶
Click to show internal directories.
Click to hide internal directories.