Releases: tkcrm/pgxgen
Releases · tkcrm/pgxgen
v0.2.7
v0.2.6
v0.2.5
v0.2.4
v0.2.3
v0.2.2
v0.2.1
v0.2.0
v0.2.0
- added support for pgx v5
- bump sqlc version to 1.18
- bump min go version to 1.20
- update all dependencies
For an example of how to use pgx v5, check out this repository: pgxgen-example
v0.1.0
This release contains critical changes for the configuration file, improved logic in go models, as well as fixing some bugs
Changes
Support for multi schema in one repository
Due to the fact that there is support for multiple migration files for one repository, it was decided to change the configuration file. An example is attached below
Config before:
version: 1
disable_auto_replace_sqlc_nullable_types: false
sqlc_move_models:
output_dir: "internal/models"
output_filename: "models.go"
package_name: models
package_path: github.com/company/project/internal/models
crud_params:
auto_remove_generated_files: true
exclude_table_name_from_methods: false
tables:
user:
output_dir: sql/queries/users
primary_column: id
methods:
create:
skip_columns:
- id
- updated_at
returning: "*"
go_constants:
tables:
users:
output_dir: internal/store/users/repo_users
Config now:
version: 1
sqlc:
- schema_dir: sql/migrations
models:
replace_sqlc_nullable_types: true
move:
output_dir: internal/models
output_file_name: models_gen.go
package_name: models
package_path: github.com/company/project/internal/models
crud:
auto_remove_generated_files: true
exclude_table_name_from_methods: false
tables:
user:
output_dir: sql/queries/users
primary_column: id
methods:
create:
skip_columns:
- id
- updated_at
returning: "*"
constants:
tables:
users:
output_dir: internal/store/users/repo_users
sqlc move models changes
disable_auto_replace_sqlc_nullable_types
moved tosqlc[0].models.replace_sqlc_nullable_types
sqlc_move_models
moved tosqlc[0].models.move
sqlc_move_models.output_filename
renamed tosqlc[0].models.move.output_file_name
and not it is required
crud changes
crud_params
moved tosqlc[0].crud
sqlc[0].schema_dir
is required param
go constants changes
go_constants
moved tosqlc[0].constants
go models changes
- remove
gen_models.delete_sqlc_data
gen_models.models_output_dir
moved togen_models.output_dir
gen_models.models_output_filename
moved togen_models.output_file_name
gen_models.models_package_name
moded togen_models.package_name
gen_models.models_imports
moved togen_models.models_imports
- added new param
gen_models.input_file_path
- added new param
gen_models.input_dir
- added new param
gen_models.delete_original_files
- added new param
gen_models.rename
: rename structs to new name - added new param
gen_models.exclude_structs
: exclude structs from result list - added new param
gen_models.include_structs
: only the listed structures will be used
json_tags
removed support for json_tags
, because we have updated go models functionality which can do much more with json tags
load configs from another paths
Now you can use any different names for config files.
- pgxgen example:
pgxgen --pgxgen-config pgxgen-new.yaml
- sqlc example:
pgxgen --sqlc-config sqlc-new.yaml
Check for new version
Added new commanв for checking latest version
pgxgen check-version
Some Changes
- use custom logger instead of fmt package
- more convenient processing of cli commands
- logging with time durations
- new utilities, improvements to existing functionality and performance optimization
- starting from this release, we will gradually cover all the code with tests. some tests already added