Documentation
¶
Overview ¶
Package core Auto-generated using python; DO NOT EDIT py 3.13.1 (tags/v3.13.1:0671451, Dec 3 2024, 19:06:28) [MSC v.1942 64 bit (AMD64)]
Index ¶
- Constants
- func ColumnName(c *plugin.Column, pos int) string
- func EnumReplace(value string) string
- func Escape(s string) string
- func IsAnyQueryMany(queries []Query) bool
- func IsInMultipleMaps[K comparable, V any](search K, maps ...map[K]V) bool
- func IsReserved(s string) bool
- func ModelName(enumName string, schemaName string, conf *Config) string
- func ParamName(p *plugin.Parameter) string
- func SQLToPyFileName(s string) string
- func SnakeToCamel(s string, conf *Config) string
- func SplitLines(s string) []string
- func UpperSnakeCase(s string) string
- func ValidateConf(conf *Config, engine string) error
- type Column
- type Config
- type Constant
- type Enum
- type FunctionArg
- type Importer
- type Override
- type OverridePyType
- type ParsedOverridePyType
- type PyType
- type Query
- type QueryValue
- type SQLDriverType
- type Table
Constants ¶
View Source
const ( ModelTypeDataclass = "dataclass" ModelTypeAttrs = "attrs" ModelTypeMsgspec = "msgspec" )
View Source
const ( DocstringConventionNone = "none" DocstringConventionGoogle = "google" DocstringConventionNumpy = "numpy" DocstringConventionPEP257 = "pep257" )
View Source
const PluginVersion = "v0.4.5"
Variables ¶
This section is empty.
Functions ¶
func EnumReplace ¶
EnumReplace removes all non ident symbols (all but letters, numbers and underscore) and returns valid ident name for provided name.
func IsAnyQueryMany ¶ added in v0.4.0
func IsInMultipleMaps ¶ added in v0.4.0
func IsInMultipleMaps[K comparable, V any](search K, maps ...map[K]V) bool
func IsReserved ¶
func SQLToPyFileName ¶
func SnakeToCamel ¶
func SplitLines ¶ added in v0.4.0
func UpperSnakeCase ¶
func ValidateConf ¶
Types ¶
type Config ¶
type Config struct {
Package string `json:"package" yaml:"package"`
SqlDriver SQLDriverType `json:"sql_driver" yaml:"sql_driver"`
ModelType string `json:"model_type" yaml:"model_type"`
Initialisms *[]string `json:"initialisms,omitempty" yaml:"initialisms,omitempty"`
EmitExactTableNames bool `json:"emit_exact_table_names" yaml:"emit_exact_table_names"`
EmitClasses bool `json:"emit_classes" yaml:"emit_classes"`
InflectionExcludeTableNames []string `json:"inflection_exclude_table_names,omitempty" yaml:"inflection_exclude_table_names,omitempty"`
OmitUnusedModels bool `json:"omit_unused_models" yaml:"omit_unused_models"`
OmitTypecheckingBlock bool `json:"omit_typechecking_block" yaml:"omit_typechecking_block"`
QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"`
OmitKwargsLimit *int32 `json:"omit_kwargs_limit,omitempty" yaml:"omit_kwargs_limit"`
EmitInitFile *bool `json:"emit_init_file" yaml:"emit_init_file"`
EmitDocstrings *string `json:"docstrings" yaml:"docstrings"`
EmitDocstringsSQL *bool `json:"docstrings_emit_sql" yaml:"docstrings_emit_sql"`
Speedups bool `json:"speedups" yaml:"speedups"`
Overrides []Override `json:"overrides,omitempty" yaml:"overrides"`
Debug bool `json:"debug" yaml:"debug"`
IndentChar string `json:"indent_char" yaml:"indent_char"`
CharsPerIndentLevel int `json:"chars_per_indent_level" yaml:"chars_per_indent_level"`
InitialismsMap map[string]struct{} `json:"-" yaml:"-"`
Async bool
}
func ParseConfig ¶
func ParseConfig(req *plugin.GenerateRequest) (*Config, error)
type FunctionArg ¶ added in v0.4.0
type Override ¶ added in v0.4.2
type Override struct {
// name of the golang type to use, e.g. `github.com/segmentio/ksuid.KSUID`
PyType OverridePyType `json:"py_type" yaml:"py_type"`
// fully qualified name of the Go type, e.g. `github.com/segmentio/ksuid.KSUID`
DBType string `json:"db_type" yaml:"db_type"`
// fully qualified name of the column, e.g. `accounts.id`
Column string `json:"column" yaml:"column"`
ColumnName *pattern.Match `json:"-"`
TableCatalog *pattern.Match `json:"-"`
TableSchema *pattern.Match `json:"-"`
TableRel *pattern.Match `json:"-"`
PyImportPath string `json:"-"`
PyPackageName string `json:"-"`
PyTypeName string `json:"-"`
PyBasicType bool `json:"-"`
}
type OverridePyType ¶ added in v0.4.2
type ParsedOverridePyType ¶ added in v0.4.2
type PyType ¶
type PyType struct {
SqlType string
Type string
DefaultType string
IsList bool
IsNullable bool
IsEnum bool
IsOverride bool
Override *Override
}
func (*PyType) DoConversion ¶ added in v0.4.2
func (p *PyType) DoConversion(conversion typeConversion.TypeDoTypeConversion) bool
func (*PyType) DoOverride ¶ added in v0.4.2
type Query ¶
type Query struct {
Cmd string
Comments []string
MethodName string
FuncName string
FieldName string
ConstantName string
SQL string
SourceName string
Ret QueryValue
Args []QueryValue
// Used for :copyfrom
Table *plugin.Identifier
}
func (Query) HasRetType ¶
type QueryValue ¶
type QueryValue struct {
Emit bool
Name string
DBName string // The name of the field in the database. Only set if Struct==nil.
Table *Table
Typ PyType
// Column is kept so late in the generation process around to differentiate
// between mysql slices and pg arrays
Column *plugin.Column
}
func (QueryValue) EmitStruct ¶
func (v QueryValue) EmitStruct() bool
func (QueryValue) IsEmpty ¶
func (v QueryValue) IsEmpty() bool
func (QueryValue) IsStruct ¶
func (v QueryValue) IsStruct() bool
func (QueryValue) Type ¶
func (v QueryValue) Type() string
type SQLDriverType ¶
type SQLDriverType string
const ( SQLDriverSQLite SQLDriverType = "sqlite3" SQLDriverAioSQLite SQLDriverType = "aiosqlite" SQLDriverAsyncpg SQLDriverType = "asyncpg" )
func (*SQLDriverType) String ¶
func (dr *SQLDriverType) String() string
Click to show internal directories.
Click to hide internal directories.