Skip to content

v0.1.0

Compare
Choose a tag to compare
@sxwebdev sxwebdev released this 08 Apr 13:28
· 27 commits to master since this release
4972b61

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 to sqlc[0].models.replace_sqlc_nullable_types
  • sqlc_move_models moved to sqlc[0].models.move
  • sqlc_move_models.output_filename renamed to sqlc[0].models.move.output_file_name and not it is required

crud changes

  • crud_params moved to sqlc[0].crud
  • sqlc[0].schema_dir is required param

go constants changes

  • go_constants moved to sqlc[0].constants

go models changes

  • remove gen_models.delete_sqlc_data
  • gen_models.models_output_dir moved to gen_models.output_dir
  • gen_models.models_output_filename moved to gen_models.output_file_name
  • gen_models.models_package_name moded to gen_models.package_name
  • gen_models.models_imports moved to gen_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