Documentation
¶
Index ¶
- Variables
- func FormatCamelCase(dbColumnName string) string
- func FormatDisplayName(dbColumnName string) string
- func FormatFieldName(dbColumnName string) string
- func ValidateSQLCConfig(projectPath string) error
- type SQLCConfig
- type TypeMapper
- func (tm *TypeMapper) GenerateConversionFromDB(fieldName, sqlcType, goType string) string
- func (tm *TypeMapper) GenerateConversionToDB(sqlcType string, goType string, valueExpr string) string
- func (tm *TypeMapper) GenerateZeroCheck(goType string, valueExpr string) string
- func (tm *TypeMapper) GetDatabaseType() string
- func (tm *TypeMapper) MapSQLTypeToGo(sqlType string, nullable bool) (goType, sqlcType, packageName string, err error)
- type TypeOverride
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoTypeMapperFound = errors.New("no type mapper found for database type") ErrUnsupportedType = errors.New("unsupported database type") )
Functions ¶
func FormatCamelCase ¶
func FormatDisplayName ¶
func FormatFieldName ¶
func ValidateSQLCConfig ¶
Types ¶
type SQLCConfig ¶
type SQLCConfig struct {
Version string `yaml:"version"`
SQL []struct {
Schema string `yaml:"schema"`
Queries string `yaml:"queries"`
Engine string `yaml:"engine"`
Gen struct {
Go struct {
Package string `yaml:"package"`
Out string `yaml:"out"`
OutputDBFileName string `yaml:"output_db_file_name"`
OutputModelsFileName string `yaml:"output_models_file_name"`
EmitMethodsWithDBArgument bool `yaml:"emit_methods_with_db_argument"`
SQLPackage string `yaml:"sql_package"`
Overrides []struct {
DBType string `yaml:"db_type"`
GoType string `yaml:"go_type"`
} `yaml:"overrides"`
} `yaml:"go"`
} `yaml:"gen"`
} `yaml:"sql"`
}
type TypeMapper ¶
type TypeMapper struct {
DatabaseType string
TypeMap map[string]string
Overrides []TypeOverride
}
func NewTypeMapper ¶
func NewTypeMapper(databaseType string) *TypeMapper
func (*TypeMapper) GenerateConversionFromDB ¶
func (tm *TypeMapper) GenerateConversionFromDB(fieldName, sqlcType, goType string) string
func (*TypeMapper) GenerateConversionToDB ¶
func (tm *TypeMapper) GenerateConversionToDB( sqlcType string, goType string, valueExpr string, ) string
func (*TypeMapper) GenerateZeroCheck ¶
func (tm *TypeMapper) GenerateZeroCheck( goType string, valueExpr string, ) string
func (*TypeMapper) GetDatabaseType ¶
func (tm *TypeMapper) GetDatabaseType() string
func (*TypeMapper) MapSQLTypeToGo ¶
func (tm *TypeMapper) MapSQLTypeToGo( sqlType string, nullable bool, ) (goType, sqlcType, packageName string, err error)
Click to show internal directories.
Click to hide internal directories.