Skip to content

v0.30.0

Latest
Compare
Choose a tag to compare
@stephenafamo stephenafamo released this 16 Jan 00:10

Added

  • Added a new field QueryFolders to gen/drivers.DBInfo for drivers to be able to include information about parsed queries.
  • Added gen/QueriesTemplates which in the future will contain base templates for generating code for parsed qureries.
  • Added a QueryTemplate field to bobgen_helpers.Templates for drivers to include additional templates for queries.
  • Added a new reserved output key queries. This is handled specially for each query folder supplied by the driver.
  • Added new wm package to each dialect for mods that modify Window clauses.
  • Added a new method Alias for View struct, for each dialect. It returns the alias of the view. (thanks @Nitjsefni7)

Changed

  • Updated error constant generation to employ specific error types for making error matching easier. (thanks @mbezhanov)
  • Collation in clause.OrderDef is now a string not an expression and is always quoted
  • Calling UpdateAll, DeleteAll and ReloadAll on an empty model slice now returns nil without running any queries.
  • UNION, INTERSECT and EXCEPT mods now append to the query instead of replacing it.
  • Generated files now end with .bob.go instead of .go and are always cleaned up before generating new files. Singleton templates are now required to have a .bob.go.tpl extension.
  • The expected structure for templates have been changed:
    • Previously, singleton templates should be kept in a singleton folder. Now, any template not inside a folder is considered a singleton template.
    • Previoulsy, templates in the root folder are merged and run for each table. Now, this will happen to templates in the table/ folder.
    • Previoulsy, the entire file tree and every subdirectory is walked to find templates. Now only templates in the root folder and the table/ folder are considered.
  • Change From in clause.Window to BasedOn to avoid confusion with FromPreceding and FromFollowing. Also change SetFrom to SetBasedOn.
  • Embed clause.OrderBy in clause.Window to make it possible to reuse OrderBy mods in window definitions.
  • Change the Definition field in clause.NamedWindow from any to clause.Window for extra type safety.
  • sm.Window now takes mods to modify the window clause.
  • fm.Over now takes mods to modify the window for the window function.

Deprecated

  • Deprecated the wipe option to delete all files in the output folder. Files are now generated with a .bob.go extension and are always cleaned up before generating new files.

Removed

  • Remove redundatnt type parameters from orm.ExecQuery.
  • Remove unnecessary interface in orm.Query and orm.ExecQuery.
  • Remove the redundant clause.IWindow interface.
  • Remove dialect.WindowMod and dialect.WindowMods which use chainable methods to modify Window clauses. This is now handled by the wm package which used mods.

Fixed

  • Fix random value generation for pq.Float64Array factory (thanks @felipeparaujo)
  • Using the UpdateMod() and DeleteMod() methods on an empty model slice now appends WHERE primary_key IN NULL which will return no results. Instead of WHERE primary_key IN () which is a syntax error.
  • Ensure net/netip is imported for the pgtypes.Inet random expression (thanks @plunkettscott)
  • Fix a data race when adding enum types.
  • Fix missing schema in table alias in pkEQ and pkIN clauses (thanks @adatob).

New Contributors

Full Changelog: v0.29.0...v0.30.0