refactor!: pre-v1.0 API design — var to func, Tx symmetry, ToSQL, Distinct#25
Merged
Conversation
…hContext, Params, Distinct BREAKING CHANGES (allowed on v0.x before API freeze): - 32 exported var → func: Eq, NotEq, And, Or, In, Like, IsUniqueViolation, etc. now proper functions with correct godoc signatures. ErrNotFound stays var (sentinel error value). - Distinct(bool) → Distinct() — no parameter, always enables DISTINCT. Tests using Distinct(false) restructured to omit the call. - Params() is now the primary method, QueryParams() deprecated. NEW FEATURES: - Tx: BatchInsert, BatchUpdate, Upsert, NewQuery — full parity with DB. - ToSQL() on UpsertQuery, BatchInsertQuery, BatchUpdateQuery — all 6 query types now support SQL preview. - ModelQuery.WithContext(ctx) — per-operation context on Model API. 7 files changed, 243 insertions, 125 deletions.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pre-v1.0 API cleanup — breaking changes that must happen before API freeze. Allowed on v0.x.
Breaking Changes
var→func: All expression builders (Eq,And,Like, etc.) and error helpers (IsUniqueViolation, etc.) are now proper functions with correct godoc signatures.ErrNotFoundstaysvar(sentinel value).Distinct(bool)→Distinct(): No parameter, always enables DISTINCT.QueryParams()deprecated: UseParams()instead.New Features
BatchInsert(),BatchUpdate(),Upsert(),NewQuery()now available on transactionsTest plan
golangci-lint run ./...= 0 issuesvarexports remain (exceptErrNotFound)