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:
2025-09-27 15:47:28 +08:00
co-authored by Claude
parent 764eccfafd
commit 304d553b3c
113 changed files with 914 additions and 432 deletions
+11 -6
View File
@@ -3,11 +3,11 @@ package postgres
import (
"strings"
"git.fsdpf.net/go/db/v2"
"git.fsdpf.net/go/db/v2/dialect/postgres"
"git.fsdpf.net/go/db/v2/internal/sb"
"git.fsdpf.net/go/db/v2/schema"
"git.fsdpf.net/go/db/v2/sqlgen"
"git.fsdpf.net/go/db"
"git.fsdpf.net/go/db/dialect/postgres"
"git.fsdpf.net/go/db/internal/sb"
"git.fsdpf.net/go/db/schema"
"git.fsdpf.net/go/db/sqlgen"
)
type Postgres struct {
@@ -41,7 +41,7 @@ func (this Postgres) TableExists(table string) (bool, error) {
func (this Postgres) CompileCreate(bp *schema.Blueprint) []string {
temporary := db.L("CREATE")
if bp.IsTemporary() {
if bp.Temporary {
temporary = db.L("CREATE TEMPORARY")
}
columns := strings.Join(this.getAddedColumns(bp), ",\n")
@@ -96,6 +96,11 @@ func (this Postgres) CompileRename(bp *schema.Blueprint) []string {
return []string{this.GenerateSQL("ALTER TABLE ? RENAME TO ?", db.T(bp.GetTable()), db.T(toName))}
}
// 修改表备注
func (this Postgres) CompileModifyComment(bp *schema.Blueprint) []string {
return []string{this.GenerateSQL("COMMENT ON TABLE ? IS ?", db.T(bp.GetTable()), db.V(bp.Comment))}
}
func (this Postgres) addModifiers(sql string, bp *schema.Blueprint, column *schema.ColumnDefinition) string {
for _, modifier := range pgDefaultModifiers {
sql += this.GetColumnModifier(modifier, bp, column)
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"os"
"testing"
"git.fsdpf.net/go/db/v2/engine"
"git.fsdpf.net/go/db/v2/schema"
"git.fsdpf.net/go/db/engine"
"git.fsdpf.net/go/db/schema"
"github.com/stretchr/testify/suite"
_ "github.com/lib/pq"