Skip to content

Releases: stephenafamo/bob

v0.23.1

03 Jan 15:55
Compare
Choose a tag to compare

Fixed

  • Do not wrap Setter.Expressions() in parenthesis

Full Changelog: v0.23.0...v0.23.1

v0.23.0

03 Jan 01:18
Compare
Choose a tag to compare

Added

  • Add bob.Cache() which saves the built SQL and args to prevent rebuilding the same query multiple times.
  • Add As() starter to alias expressions
  • Add OP() builder method for using custom operators
  • Add table.InsertQ(ctx, db) now includes the insert columns from the table model.
  • It is now possible to configure additional constraints for code generation.
  • Add um.SetCol() which maintains the old behavior of um.Set().
  • Generate additional Expressions() method for Setters to make it easier to use them in um.Set() or im.Set().

Changed

  • Aliases configuration for code generation no longer has a top level table key
  • When configuring relationships, from_unique, to_unique, key_nullable can no longer be configured. They are now inferred from the database.
  • When configuring relationships, to_key has been changed to modify and should be set to from, to or "" to indicate which side of the relationship to modify.
    If left empty, Bob will try to guess which side to modify based on the presence of primary keys and unique columns.
  • RelWhere.Value is now RelWhere.SQLValue
  • Change CONFLICT/DUPLICATE KEY UPDATE to use mods instead of a chainable methods.
  • Change um.Set() to take a list of expressions.
  • Rename Setter method from Insert() to InsertMod() to avoid confusion.

Fixed

  • Prevent generating duplicate relationships for many-to-many self-join relationships
  • Correctly use table alias in generated relationship join mods
  • Fix an issue where CTEs were encased in double parenthesis
  • Fix invalid SQL generated when doing JOIN USING
  • Correctly include "AS" in function query if alias is set
  • Setters are also generated for tables that have relationships, even if they have no primary key
  • Column aliases in CTEs are now correctly included in the final query
  • Fix several issues with generating code for multi-sided relationships
  • Fix an issue where loading many-to-many relationships cause no columns to be selected unless specified
  • Fix an issue where many-to-many relationships would not be able to use nested loaders

New Contributors

Full Changelog: v0.22.0...v0.23.0

v0.22.0

18 Aug 11:53
Compare
Choose a tag to compare

Added

  • Expand expressions when used in Raw (thanks @RangelReale)
  • Add InsertQ, UpdateQ, and DeleteQ methods to Table models to start INSERT, UPDATE and DELETE queries respectively.
  • Allow column comment for replacement matching (thanks @jroenf)
  • Add table query hooks to modify model queries
  • Include WhereOr and WhereAnd to make it easier to combine multiple generated where clauses
  • Print a warning if a replacement rule did not find a match (thanks @jacobmolby)

Changed

  • Export generated factory.Factory struct
  • Allow Limit and Offset to be used as Arguments in PostgreSQL (thanks @RangelReale)
  • Make model hooks take slices not single objects
  • Return rows affected from Exec() method of view queries instead of sql.Result
  • Chain comparison methods now take an Expression instead of any
  • Table models now require the types to implement orm.Table and orm.Setter interfaces.

Removed

  • Remove UpdateAll and DeleteAll methods on the Table models.

Fixed

  • Honor Only and Except in sqlite driver
  • Always surround subqueries with parenthesis when used as an expression
  • Fix mysql TablesInfo method and make sure we don't exclude entire table when targeting columns (thanks @jacobmolby)
  • Fix bug in sqlite foreign key and join table detection

New Contributors

Full Changelog: v0.21.1...v0.22.0

v0.21.1

22 May 12:59
Compare
Choose a tag to compare

Fixed

  • Fix Upsert and UpsertAll methods of mysql.Table

Full Changelog: v0.21.0...v0.21.1

v0.21.0

09 May 22:36
Compare
Choose a tag to compare

Changed

  • Force uniqueness of relationship names in psql driver

Fixed

  • Fix panic when attaching associated relationships
  • Make getting a random integer for preloading thread-safe

Full Changelog: v0.20.6...v0.21.0

v0.20.6

25 Apr 11:19
Compare
Choose a tag to compare
  • Check all members when loading relationships

Full Changelog: v0.20.5...v0.20.6

v0.20.5

14 Apr 07:17
Compare
Choose a tag to compare
  • Fix panic in Insert/Attach Relationship loop

Full Changelog: v0.20.4...v0.20.5

v0.20.4

07 Apr 19:35
Compare
Choose a tag to compare
  • Replace huandu/go-clone with qdm12/reprint

Full Changelog: v0.20.3...v0.20.4

v0.20.3

06 Apr 22:07
Compare
Choose a tag to compare
  • Fix cloning bug by replacing jinzhu/copier with huandu/go-clone

Full Changelog: v0.20.2...v0.20.3

v0.20.2

05 Apr 10:39
Compare
Choose a tag to compare
  • Account for windows when calculating models module path

Full Changelog: v0.20.1...v0.20.2