docs: Add CLAUDE.md with codebase guidance
Create comprehensive documentation for future Claude Code instances working in this repository, including: - Development commands for testing, building, and code quality - Core architecture overview of the SQL query builder system - Directory structure and component explanations - Testing patterns and conventions - Key dependencies and their purposes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+24
-6
@@ -1,10 +1,10 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"git.fsdpf.net/go/db/v2/exec"
|
||||
"git.fsdpf.net/go/db/v2/exp"
|
||||
"git.fsdpf.net/go/db/v2/internal/errors"
|
||||
"git.fsdpf.net/go/db/v2/internal/sb"
|
||||
"git.fsdpf.net/go/db/exec"
|
||||
"git.fsdpf.net/go/db/exp"
|
||||
"git.fsdpf.net/go/db/internal/errors"
|
||||
"git.fsdpf.net/go/db/internal/sb"
|
||||
)
|
||||
|
||||
type UpdateDataset struct {
|
||||
@@ -13,6 +13,7 @@ type UpdateDataset struct {
|
||||
isPrepared prepared
|
||||
queryFactory exec.QueryFactory
|
||||
err error
|
||||
hooks exec.Hooks
|
||||
}
|
||||
|
||||
var ErrUnsupportedUpdateTableType = errors.New("unsupported table type, a string or identifier expression is required")
|
||||
@@ -84,6 +85,7 @@ func (ud *UpdateDataset) copy(clauses exp.UpdateClauses) *UpdateDataset {
|
||||
isPrepared: ud.isPrepared,
|
||||
queryFactory: ud.queryFactory,
|
||||
err: ud.err,
|
||||
hooks: ud.hooks,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,8 +234,24 @@ func (ud *UpdateDataset) ReturnsColumns() bool {
|
||||
// Generates the UPDATE sql, and returns an exec.QueryExecutor with the sql set to the UPDATE statement
|
||||
//
|
||||
// db.Update("test").Set(Record{"name":"Bob", update: time.Now()}).Executor()
|
||||
func (ud *UpdateDataset) Executor() exec.QueryExecutor {
|
||||
return ud.queryFactory.FromSQLBuilder(ud.updateSQLBuilder())
|
||||
func (ud *UpdateDataset) Executor() (executor exec.QueryExecutor) {
|
||||
if ud.hooks != nil {
|
||||
ud.SetError(ud.hooks.Before(ud))
|
||||
}
|
||||
executor = ud.queryFactory.FromSQLBuilder(ud.updateSQLBuilder())
|
||||
if ud.hooks != nil {
|
||||
executor.Hook(func(result interface{}) error {
|
||||
return ud.hooks.After(ud, result)
|
||||
})
|
||||
}
|
||||
return executor
|
||||
}
|
||||
|
||||
func (ud *UpdateDataset) WithHook(hooks exec.Hooks) *UpdateDataset {
|
||||
if ud.hooks == nil {
|
||||
ud.hooks = hooks
|
||||
}
|
||||
return ud
|
||||
}
|
||||
|
||||
func (ud *UpdateDataset) updateSQLBuilder() sb.SQLBuilder {
|
||||
|
||||
Reference in New Issue
Block a user