Query helper packages
Generated whenever the matching -db type is selected — simplified, struct-based CRUD helpers on top of the raw driver, so store/ code isn't hand-rolling query strings for common cases.
t := mysql.Conn("core").Table("users")
users, err := mysql.Get[User](ctx, t, User{Active: true})
one, err := mysql.GetOne[User](ctx, t, User{ID: id})
err = mysql.Insert(ctx, t, User{ID: id, Name: "x"})
err = mysql.Update(ctx, t, User{ID: id}, User{Name: "y"}) // filter, then patch
err = mysql.Delete(ctx, t, User{ID: id})
rows, err := mysql.Query[Report](ctx, mysql.Conn("core"), "select * from tbl_y")Field matching uses a struct's non-zero fields (AND'd together; a slice ORs each element), mapped via the db tag (or bson for Mongo). Insert writes every field, zeros included; Update patches only non-zero fields — worth remembering, since the two are intentionally asymmetric. On the Mongo side, mongo.Update[T](ctx, coll, filter, patch) builds the same non-zero-field patch into a $set document (unlike Set, which replaces the whole matching document); like every dialect's Update, it refuses an empty filter (would match every document) and a patch with no non-zero fields. Query/Call (or Aggregate for Mongo) are the raw escape hatches for anything the struct-filter model can't express — including Mongo-native update operators ($inc, $push, etc.), which mongo.Update doesn't cover. An embedded anonymous struct field (e.g. store/common.Base, below) is flattened into the same top-level filter, so Widget{Base: common.Base{ID: id}} correctly filters on _id.
For -db mongo apps, store/common.Base (type Base struct { ID bson.ObjectID }, tagged for Mongo's _id) is generated for exactly this — embed it anonymously in any domain struct to pick up an ID field the same way every time, instead of redeclaring it per type.
-db mongo apps also get mongo.Filter{And, Or []any}, for nested AND/OR expressions a plain struct/slice filter can't express (e.g. Filter{And: []any{Filter{Or: []any{Widget{ID: a}, Widget{ID: b}}}, Widget{Active: true}}}), and mongo.Filter{Eq: map[string]any{...}}, an explicit key:value form that's included in the query verbatim — zero values included — for matching a value a struct filter would otherwise silently drop (e.g. Filter{Eq: map[string]any{"isDeleted": false}}). A single Filter sets exactly one of And, Or, or Eq; nest another Filter inside And/Or to combine forms.