Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump github.com/stephenafamo/bob from 0.28.0 to 0.29.0 #386

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Dec 9, 2024

Bumps github.com/stephenafamo/bob from 0.28.0 to 0.29.0.

Release notes

Sourced from github.com/stephenafamo/bob's releases.

v0.29.0

Added

  • Added error constants for matching against both specific and generic unique constraint errors raised by the underlying database driver. (thanks @​mbezhanov)
  • Added support for regular expressions in the only and except table filters. (thanks @​mbezhanov)
  • Added ContextualMods which are similar to regular mods but take a context argument. They are applied whenever the query is built.
    This makes it cleaner to do certain things, like populating the select columns of a model if none was explicitly added.
    The previous way this was done was unreliable since using q.MustBuild() would not add the columns while bob.MustBuild(q) will add them correctly.
  • modelSlice.UpdateMod() and modelSlice.DeleteMod() are new methods that returns a mod for update and delete queries on a slice of models.
    It adds WHERE pk IN (pk1, pk2, pk3, ...) to the query, and also schedule running the hooks.
  • Added bob.ToMods which a slice of structs that implement bob.Mod[T] to a Mod. This is useful since Go does not allow using a slice of structs as a slice of an interface the struct implements.
  • Added bob.HookableQuery interface. If a query implements this interface, the method RunHooks(ctx, exec) will be called before the query is executed.
  • Added bob.HookableType interface. If a type implements this interface, the method AfterQueryHook(ctx, exec, bob.QueryType) will be called after the query is executed.
    This is how AfterSeleect/Insert/Update/DeleteHooks hooks are now implemented.
  • Added Type() QueryType method to bob.Query to get the type of query it is. Available constants are Unknown, Select, Insert, Update, Delete.
  • Postgres and SQLite Update/Delete queries now refresh the models after the query is executed. This is enabled by the RETURNING clause, so it is not available in MySQL.
  • Added the Case() starter to all dialects to build CASE expressions. (thanks @​k4n4ry)
  • Added bob.Named() which is used to add named arguments to the query and bind them later.
  • Added bob.BindNamed which takes an argument (struct, map, or a single value type) to be used to bind named arguments in a query. See changes to bob.Prepare() for details of which type can be used.
  • Indexes now include more information such as the type, unique and comment fields.
  • Constraints now include a comment field.
  • Added Checks field to DBConstraints so that drivers can also load check constraints. (not yet supported by the SQLite driver).
  • Added comments field to Table definitions.

Changed

  • context.Context is now passed to Query.WriteQuery() and Expression.WriteSQL() methods. This allows for more control over how the query is built and executed.
    This change made is possible to delete some hacks and simplify the codebase.

    • The Name() and NameAs() methods of Views/Tables no longer need the context argument since the context will be passed when writing the expression. The API then becomes cleaner.
    • Preloading mods no longer need to store a context internally. SetLoadContext() and GetLoadContext() have removed.
    • The ToExpr field in orm.RelSide which was used for preloading is no longer needed and has been removed.
  • Moved orm.Hooks to bob.Hooks since it should not be limited to only ORM queries.

  • Moved mods.QueryModFunc to bob.ModFunc since it should be available to all packages.

  • The mod capability for orm.Setter is now reversed. It should now be a mod for Insert and have a method that returns a mod for Update.
    This makes more sense since one would at most use one setter during updates, but can use multiple setters in a bulk insert.

  • table.InsertQ has been renamed to table.Insert. The old implementation of Insert has been removed.
    The same functionality can be achieved in the following way:

    //----------------------------------------------
    // OLD WAY
    //----------------------------------------------
    user, err := models.Users.Insert(ctx, db, setter) // insert one
    users, err := models.Users.InsertMany(ctx, db, setters...) // insert many
    //----------------------------------------------
    // NEW WAY
    //----------------------------------------------
    user, err := models.Users.Insert(setter).One(ctx, db) // insert one
    users, err := models.Users.Insert(setters[0], setters[1]).All(ctx, db) // insert many

... (truncated)

Changelog

Sourced from github.com/stephenafamo/bob's changelog.

[v0.29.0] - 2024-11-20

Added

  • Added error constants for matching against both specific and generic unique constraint errors raised by the underlying database driver. (thanks @​mbezhanov)
  • Added support for regular expressions in the only and except table filters. (thanks @​mbezhanov)
  • Added ContextualMods which are similar to regular mods but take a context argument. They are applied whenever the query is built.
    This makes it cleaner to do certain things, like populating the select columns of a model if none was explicitly added.
    The previous way this was done was unreliable since using q.MustBuild() would not add the columns while bob.MustBuild(q) will add them correctly.
  • modelSlice.UpdateMod() and modelSlice.DeleteMod() are new methods that returns a mod for update and delete queries on a slice of models.
    It adds WHERE pk IN (pk1, pk2, pk3, ...) to the query, and also schedule running the hooks.
  • Added bob.ToMods which a slice of structs that implement bob.Mod[T] to a Mod. This is useful since Go does not allow using a slice of structs as a slice of an interface the struct implements.
  • Added bob.HookableQuery interface. If a query implements this interface, the method RunHooks(ctx, exec) will be called before the query is executed.
  • Added bob.HookableType interface. If a type implements this interface, the method AfterQueryHook(ctx, exec, bob.QueryType) will be called after the query is executed.
    This is how AfterSeleect/Insert/Update/DeleteHooks hooks are now implemented.
  • Added Type() QueryType method to bob.Query to get the type of query it is. Available constants are Unknown, Select, Insert, Update, Delete.
  • Postgres and SQLite Update/Delete queries now refresh the models after the query is executed. This is enabled by the RETURNING clause, so it is not available in MySQL.
  • Added the Case() starter to all dialects to build CASE expressions. (thanks @​k4n4ry)
  • Added bob.Named() which is used to add named arguments to the query and bind them later.
  • Added bob.BindNamed which takes an argument (struct, map, or a single value type) to be used to bind named arguments in a query. See changes to bob.Prepare() for details of which type can be used.
  • Indexes now include more information such as the type, unique and comment fields.
  • Constraints now include a comment field.
  • Added Checks field to DBConstraints so that drivers can also load check constraints. (not yet supported by the SQLite driver).
  • Added comments field to Table definitions.

Changed

  • context.Context is now passed to Query.WriteQuery() and Expression.WriteSQL() methods. This allows for more control over how the query is built and executed.
    This change made is possible to delete some hacks and simplify the codebase.

    • The Name() and NameAs() methods of Views/Tables no longer need the context argument since the context will be passed when writing the expression. The API then becomes cleaner.
    • Preloading mods no longer need to store a context internally. SetLoadContext() and GetLoadContext() have removed.
    • The ToExpr field in orm.RelSide which was used for preloading is no longer needed and has been removed.
  • Moved orm.Hooks to bob.Hooks since it should not be limited to only ORM queries.

  • Moved mods.QueryModFunc to bob.ModFunc since it should be available to all packages.

  • The mod capability for orm.Setter is now reversed. It should now be a mod for Insert and have a method that returns a mod for Update.
    This makes more sense since one would at most use one setter during updates, but can use multiple setters in a bulk insert.

  • table.InsertQ has been renamed to table.Insert. The old implementation of Insert has been removed.
    The same functionality can be achieved in the following way:

    //----------------------------------------------
    // OLD WAY
    //----------------------------------------------
    user, err := models.Users.Insert(ctx, db, setter) // insert one
    users, err := models.Users.InsertMany(ctx, db, setters...) // insert many
    //----------------------------------------------
    // NEW WAY
    //----------------------------------------------
    user, err := models.Users.Insert(setter).One(ctx, db) // insert one

... (truncated)

Commits
  • 7b110e3 Bump version
  • 59f0721 Merge pull request #303 from stephenafamo/indexes
  • 387c0d4 Refactor loading of indexes and constraints
  • 37c3fb1 Merge pull request #302 from stephenafamo/generic-table
  • a8ee78c Huge refactor so that tables can be generic
  • 793e307 Merge pull request #301 from stephenafamo/atlas-prisma
  • 7aeefd7 Remove the Atlas and Prisma codgen drivers
  • 428c45b Update sqlparser package
  • b043f04 Merge pull request #298 from stephenafamo/prepare
  • 4b7fa99 Add named arguments along with a function to bind to the named args
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [github.com/stephenafamo/bob](https://github.com/stephenafamo/bob) from 0.28.0 to 0.29.0.
- [Release notes](https://github.com/stephenafamo/bob/releases)
- [Changelog](https://github.com/stephenafamo/bob/blob/main/CHANGELOG.md)
- [Commits](stephenafamo/bob@v0.28.0...v0.29.0)

---
updated-dependencies:
- dependency-name: github.com/stephenafamo/bob
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Dec 9, 2024
Copy link

openshift-ci bot commented Dec 9, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign donpenney for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 9, 2024
Copy link

openshift-ci bot commented Dec 9, 2024

Hi @dependabot[bot]. Thanks for your PR.

I'm waiting for a openshift-kni member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@donpenney
Copy link
Collaborator

This requires go 1.23.
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 10, 2024
@donpenney
Copy link
Collaborator

Closing due to go version requirement

@donpenney donpenney closed this Dec 10, 2024
Copy link
Contributor Author

dependabot bot commented on behalf of github Dec 10, 2024

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version. You can also ignore all major, minor, or patch releases for a dependency by adding an ignore condition with the desired update_types to your config file.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.

@dependabot dependabot bot deleted the dependabot/go_modules/github.com/stephenafamo/bob-0.29.0 branch December 10, 2024 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant