Documentation
¶
Overview ¶
Package model 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 ¶
- func ColumnName(pluginColumn *plugin.Column, pos int) string
- func DedupClassName(name string, seen map[string]int) string
- func DedupName(name string, seen map[string]int) string
- func EnumConstantName(value string, index int, seen map[string]int) string
- func EnumName(config *config.Config, enumName string, schemaName string) string
- func Escape(s string) string
- func EscapedColumnName(pluginColumn *plugin.Column, pos int) string
- func IsReserved(s string) bool
- func ModelName(config *config.Config, modelName string, schemaName string) string
- func ParamName(p *plugin.Parameter) string
- func Singular(s SingularParams) string
- func SnakeToCamel(conf *config.Config, s string) string
- func UpperSnakeCase(s string) string
- type Column
- type Embed
- type Enum
- type EnumConstants
- type PyType
- type Query
- type QueryValue
- type SingularParams
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DedupClassName ¶
DedupClassName is DedupName with a bare digit suffix ("Name", "Name2", ...): an underscore suffix would violate the CapWords convention (N801).
func DedupName ¶
DedupName makes repeated Python identifiers unique by appending a numeric suffix ("name", "name_2", "name_3", ...). Suffixes are probed until an unused identifier is found, so a literal "name_2" that appeared earlier can never collide with a generated one. seen tracks usage counts per scope.
func EnumConstantName ¶
EnumConstantName converts an enum value into a valid, unique Python constant name: non-alphanumeric characters become underscores, empty results fall back to VALUE_N, digit- and underscore-leading names get a VALUE_ prefix, and duplicates get a numeric suffix. seen tracks names across one enum.
func EnumName ¶
EnumName builds the class name for a SQL enum. Enum type names are never singularized - they are type names, not table names.
func IsReserved ¶
func ModelName ¶
ModelName builds the class name for a table. Singularization runs on the raw snake_case table name (before camel-casing) so that inflection_exclude_table_names entries, which users write in snake_case, match correctly. For non-default-schema tables exclusions match BOTH the bare table name ("events") and the schema-qualified form ("analytics_events") - v0.4.x singularized the qualified string, so existing configs use the qualified spelling.
func ParamName ¶
ParamName allows leading underscores: parameters are plain kwargs, never attrs/pydantic fields, so only digit-leading names need the prefix.
func Singular ¶
func Singular(s SingularParams) string
func UpperSnakeCase ¶
Types ¶
type Enum ¶
type Enum struct {
Name string
Constants []EnumConstants
}
type EnumConstants ¶
type PyType ¶
type PyType struct {
SQLType string
Type string
IsNullable bool
IsList bool
IsEnum bool
// IsOverride marks a type replaced via the overrides config option.
IsOverride bool
// DefaultType is the Python type the column would have without the
// override. Used to convert override values before passing them to the driver.
DefaultType string
}
func (PyType) DoOverride ¶
DoOverride reports whether this type has an active override.
func (PyType) PrintOptional ¶
PrintOptional prints the type with a guaranteed "| None" suffix for values that may be absent at runtime (e.g. :one queries that match no row).
type Query ¶
type Query struct {
Cmd string // The command of the query: https://docs.sqlc.dev/en/latest/reference/query-annotations.html
SQL string // The raw SQL of the query
ConstantName string // The name of the constant where the raw SQL will be saved in python
FuncName string // The name of the python function
QueryName string // The original name of the query
FileName string // The original filename where the query is located
ModuleName string // The name of the python module in which the query will be implemented
Params []QueryValue
Returns QueryValue
Table *plugin.Identifier // The name of the table this query inserts into. Only used for :copyfrom
}
func (Query) EmitsTable ¶
type QueryValue ¶
func (QueryValue) IsEmpty ¶
func (v QueryValue) IsEmpty() bool
IsEmpty reports whether this value is unset.
func (QueryValue) IsStruct ¶
func (v QueryValue) IsStruct() bool
IsStruct reports whether this value is a structured type (table reference).