v0.2.0 -> v0.3.0
Summary
Added Delete method and refactored API to use chainable Context pattern, unifying Insert/Update return values for consistency.
Changes
FEAT
- Add
Delete(force ...bool)method for row deletion with optional force flag for unprotected deletes - Add
Context(ctx context.Context)chainable method for context propagation
REFACTOR
- Unify
Insert()to return(int64, error)with LastInsertId instead of just error - Unify
Update()to return(int64, error)with RowsAffected instead of(sql.Result, error) - Extract SQL building logic into independent methods:
buildJoin(),buildOrderBy(),buildLimit(),buildOffset() - Add
ExecAutoAsignContext()helper to automatically use context when available - Move
Where()andOrWhere()to dedicated files for better organization
UPDATE
- Mark legacy Context methods as deprecated:
InsertContext(),InsertReturningID(),InsertContextReturningID(),InsertConflict(),InsertContexConflict(),InsertConflictReturningID(),InsertContextConflictReturningID(),GetContext(),GetWithTotal(),GetWithTotalContext(),FirstContext(),CountContext(),UpdateContext() - Remove deprecated
insertBuilderConflict()internal function
Files Changed
| File | Status | Tag |
|---|---|---|
builder.go |
Modified | FEAT |
insert.go |
Modified | REFACTOR |
select.go |
Modified | REFACTOR |
select_ext.go |
Modified | REFACTOR |
select_where.go |
Modified | REFACTOR |
select_or_where.go |
Modified | REFACTOR |
update.go |
Modified | REFACTOR |
main_test.go |
Modified | TEST |
README.md |
Modified | DOC |
README.zh.md |
Modified | DOC |
©️ 2026 邱敬幃 Pardn Chiu
Top comments (0)