Documentation
¶
Index ¶
Constants ¶
View Source
const ( SQLPackagePGXV4 string = "pgx/v4" SQLPackagePGXV5 string = "pgx/v5" SQLPackageStandard string = "database/sql" )
Variables ¶
This section is empty.
Functions ¶
func ValidateOpts ¶
Types ¶
type Cache ¶ added in v0.1.1
type Cache struct { // Table is the name of the table of a loader. Table string `json:"table" yaml:"table"` // Type is the type of the cache. Available types: memory, lru, no-cache. Type string `json:"type" yaml:"type"` // Ttl is the time to live for the items in cache. It is used only for lru cache. // Example values: "1m", "1h", "1d". Ttl string `json:"ttl" yaml:"ttl"` // Size is the size of the cache. It is used only for lru cache. Size int `json:"size" yaml:"size"` }
type GlobalOptions ¶
type GoType ¶
type GoType struct { Path string `json:"import" yaml:"import"` Package string `json:"package" yaml:"package"` Name string `json:"type" yaml:"type"` Pointer bool `json:"pointer" yaml:"pointer"` Slice bool `json:"slice" yaml:"slice"` Spec string `json:"-"` BuiltIn bool `json:"-"` }
func (*GoType) MarshalJSON ¶
func (*GoType) UnmarshalJSON ¶
func (*GoType) UnmarshalYAML ¶
type Options ¶
type Options struct { EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` Package string `json:"package" yaml:"package"` Out string `json:"out" yaml:"out"` Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` Rename map[string]string `json:"rename,omitempty" yaml:"rename"` OmitSqlcVersion bool `json:"omit_sqlc_version,omitempty" yaml:"omit_sqlc_version"` DefaultSchema string `json:"default_schema,omitempty" yaml:"default_schema"` InflectionExcludeTableNames []string `json:"inflection_exclude_table_names,omitempty" yaml:"inflection_exclude_table_names"` Initialisms *[]string `json:"initialisms,omitempty" yaml:"initialisms"` SqlPackage string `json:"sql_package" yaml:"sql_package"` EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` PrimaryKeysColumns []string `json:"primary_keys_columns" yaml:"primary_keys_columns"` ModelImport string `json:"model_import" yaml:"model_import"` Cache []Cache `json:"cache" yaml:"cache"` ExcludeTables []string `json:"exclude_tables" yaml:"exclude_tables"` InitialismsMap map[string]struct{} `json:"-" yaml:"-"` }
type Override ¶
type Override struct { // name of the golang type to use, e.g. `github.com/segmentio/ksuid.KSUID` GoType GoType `json:"go_type" yaml:"go_type"` // additional Go struct tags to add to this field, in raw Go struct tag form, e.g. `validate:"required" x:"y,z"` // see https://github.com/sqlc-dev/sqlc/issues/534 GoStructTag GoStructTag `json:"go_struct_tag" yaml:"go_struct_tag"` // fully qualified name of the Go type, e.g. `github.com/segmentio/ksuid.KSUID` DBType string `json:"db_type" yaml:"db_type"` Deprecated_PostgresType string `json:"postgres_type" yaml:"postgres_type"` // for global overrides only when two different engines are in use Engine string `json:"engine,omitempty" yaml:"engine"` // True if the GoType should override if the matching type is nullable Nullable bool `json:"nullable" yaml:"nullable"` // True if the GoType should override if the matching type is unsiged. Unsigned bool `json:"unsigned" yaml:"unsigned"` // Deprecated. Use the `nullable` property instead Deprecated_Null bool `json:"null" yaml:"null"` // 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:"-"` GoImportPath string `json:"-"` GoPackage string `json:"-"` GoTypeName string `json:"-"` GoBasicType bool `json:"-"` // Parsed form of GoStructTag, e.g. {"validate:", "required"} GoStructTags map[string]string `json:"-"` ShimOverride *ShimOverride `json:"-"` }
type ParsedGoType ¶
type ShimGoType ¶
type ShimOverride ¶
type ShimOverride struct { DbType string Nullable bool Column string Table *plugin.Identifier ColumnName string Unsigned bool GoType *ShimGoType }
The ShimOverride struct exists to bridge the gap between the Override struct and the previous Override struct defined in codegen.proto. Eventually these shim structs should be removed in favor of using the existing Override and GoType structs, but it's easier to provide these shim structs to not change the existing, working code.
Click to show internal directories.
Click to hide internal directories.