Added
- Added a new field
QueryFolders
togen/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 tobobgen_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 modifyWindow
clauses. - Added a new method
Alias
forView
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
andReloadAll
on an empty model slice now returns nil without running any queries. UNION
,INTERSECT
andEXCEPT
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.
- Previously, singleton templates should be kept in a
- Change
From
inclause.Window
toBasedOn
to avoid confusion withFromPreceding
andFromFollowing
. Also changeSetFrom
toSetBasedOn
. - Embed
clause.OrderBy
inclause.Window
to make it possible to reuseOrderBy
mods in window definitions. - Change the
Definition
field inclause.NamedWindow
fromany
toclause.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
andorm.ExecQuery
. - Remove the redundant
clause.IWindow
interface. - Remove
dialect.WindowMod
anddialect.WindowMods
which use chainable methods to modifyWindow
clauses. This is now handled by thewm
package which used mods.
Fixed
- Fix random value generation for pq.Float64Array factory (thanks @felipeparaujo)
- Using the
UpdateMod()
andDeleteMod()
methods on an empty model slice now appendsWHERE primary_key IN NULL
which will return no results. Instead ofWHERE primary_key IN ()
which is a syntax error. - Ensure
net/netip
is imported for thepgtypes.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
- @felipeparaujo made their first contribution in #321
- @plunkettscott made their first contribution in #328
- @adatob made their first contribution in #327
- @Nitjsefni7 made their first contribution in #339
Full Changelog: v0.29.0...v0.30.0