Type object
File match pgxgen.yml pgxgen.yaml
Schema URL https://catalog.lintel.tools/schemas/schemastore/pgxgen/latest.json
Source https://raw.githubusercontent.com/tkcrm/pgxgen/refs/heads/master/schemas/pgxgen-schema.json

Validate with Lintel

npx @lintel/lintel check
Type: object

Configuration file for pgxgen code generator

Properties

version string required

Config version (must be '2')

Constant: "2"
schemas schema[] required

Array of schema configurations, each with its own engine and tables

minItems=1
templates object

User-provided template directories

2 nested properties
crud_dir string

Directory with custom CRUD SQL templates

models_dir string

Directory with custom Go model templates

Definitions

schema object
name string required

Human-readable schema name

engine string required

Database engine

Values: "postgresql" "mysql" "sqlite"
schema_dir string required

Path to SQL migration/schema files

models object
12 nested properties
output_dir string required
package_name string required
output_file_name string
Default: "models.go"
package_path string

Full Go import path for the models package

custom_types string[]

Custom types defined in the models package

skip_tables string[]

Table/view names to exclude from model generation

skip_enums string[]

Enum names to exclude from model generation

emit_json_tags boolean
Default: false
emit_db_tags boolean
Default: false
emit_pointers_for_null boolean
Default: false
include_struct_comments boolean

Add // @name StructName comments to generated structs (useful for Swagger)

Default: false
sql_package string
Values: "pgx/v5" "pgx/v4" "database/sql"
sqlc object
2 nested properties
defaults object

Default sqlc gen.go options applied to all repos

14 nested properties
sql_package string
Values: "pgx/v5" "pgx/v4" "database/sql"
emit_prepared_queries boolean
emit_interface boolean
emit_json_tags boolean
emit_db_tags boolean
emit_exported_queries boolean
emit_exact_table_names boolean
emit_empty_slices boolean
emit_result_struct_pointers boolean
emit_params_struct_pointers boolean
emit_enum_valid_method boolean
emit_all_enum_values boolean
query_parameter_limit integer
json_tags_case_style string
overrides object
3 nested properties
rename Record<string, string>
types object[]
columns object[]
defaults object
8 nested properties
queries_dir_prefix string

Per-table repos: queries_dir = {prefix}/{table_name} (not affected by package_prefix/package_suffix)

output_dir_prefix string

Per-table repos: output_dir = {prefix}/{package_prefix}{table_name}{package_suffix}

package_prefix string

Per-table repos: prefix for the output directory/package name (does not affect queries_dir_prefix), e.g. repo_

package_suffix string

Per-table repos: suffix for the output directory/package name (does not affect queries_dir_prefix), e.g. _repo

queries_dir string

Single repo: all queries in one directory

output_dir string

Single repo: all output in one directory

crud object
3 nested properties
auto_clean boolean
exclude_table_name boolean
methods Record<string, object | null>
constants object
1 nested properties
include_column_names boolean
tables Record<string, object>

Per-table configuration (crud + constants + sqlc)

custom_queries custom_query[]
models object
output_dir string required
package_name string required
output_file_name string
Default: "models.go"
package_path string

Full Go import path for the models package

custom_types string[]

Custom types defined in the models package

skip_tables string[]

Table/view names to exclude from model generation

skip_enums string[]

Enum names to exclude from model generation

emit_json_tags boolean
Default: false
emit_db_tags boolean
Default: false
emit_pointers_for_null boolean
Default: false
include_struct_comments boolean

Add // @name StructName comments to generated structs (useful for Swagger)

Default: false
sql_package string
Values: "pgx/v5" "pgx/v4" "database/sql"
sqlc object
defaults object

Default sqlc gen.go options applied to all repos

14 nested properties
sql_package string
Values: "pgx/v5" "pgx/v4" "database/sql"
emit_prepared_queries boolean
emit_interface boolean
emit_json_tags boolean
emit_db_tags boolean
emit_exported_queries boolean
emit_exact_table_names boolean
emit_empty_slices boolean
emit_result_struct_pointers boolean
emit_params_struct_pointers boolean
emit_enum_valid_method boolean
emit_all_enum_values boolean
query_parameter_limit integer
json_tags_case_style string
overrides object
3 nested properties
rename Record<string, string>
types object[]
columns object[]
defaults object
queries_dir_prefix string

Per-table repos: queries_dir = {prefix}/{table_name} (not affected by package_prefix/package_suffix)

output_dir_prefix string

Per-table repos: output_dir = {prefix}/{package_prefix}{table_name}{package_suffix}

package_prefix string

Per-table repos: prefix for the output directory/package name (does not affect queries_dir_prefix), e.g. repo_

package_suffix string

Per-table repos: suffix for the output directory/package name (does not affect queries_dir_prefix), e.g. _repo

queries_dir string

Single repo: all queries in one directory

output_dir string

Single repo: all output in one directory

crud object
3 nested properties
auto_clean boolean
exclude_table_name boolean
methods Record<string, object | null>
constants object
1 nested properties
include_column_names boolean
table object
primary_column string
queries_dir string

Override queries directory

output_dir string

Override output directory

sqlc object
1 nested properties
query_parameter_limit integer
crud object
1 nested properties
methods Record<string, object | null>
constants object
1 nested properties
include_column_names boolean
soft_delete object
1 nested properties
column string required
method object | null
name string

Override method name

returning string

RETURNING clause (PostgreSQL)

where Record<string, object>
where_additional string[]
skip_columns string[]
column_values Record<string, string>
limit boolean
order object
2 nested properties
by string required
direction string
Default: "DESC"
Values: "ASC" "DESC"
custom_query object
name string required
type string required
Values: "one" "many" "exec" "copyfrom"
sql string required
table string

Output to this table's queries_dir

output_dir string