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:
@@ -5,11 +5,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.fsdpf.net/go/db/v2"
|
||||
"git.fsdpf.net/go/db/v2/dialect/sqlite3"
|
||||
"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/sqlite3"
|
||||
"git.fsdpf.net/go/db/internal/sb"
|
||||
"git.fsdpf.net/go/db/schema"
|
||||
"git.fsdpf.net/go/db/sqlgen"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -72,8 +72,15 @@ func (this Sqlite3) CompileCreate(bp *schema.Blueprint) (sqls []string) {
|
||||
}
|
||||
columns = append(columns, sql)
|
||||
}
|
||||
|
||||
prefix := "? TABLE ? (\n?\n)"
|
||||
|
||||
if comment := bp.Comment; comment != "" {
|
||||
prefix = "? TABLE ? ( -- " + comment + "\n?\n)"
|
||||
}
|
||||
|
||||
sqls = append(sqls,
|
||||
this.GenerateSQL("? TABLE ? (\n?\n)",
|
||||
this.GenerateSQL(prefix,
|
||||
temporary,
|
||||
db.T(bp.GetTable()),
|
||||
db.L(strings.Join(columns, "\n")),
|
||||
@@ -152,6 +159,11 @@ func (this Sqlite3) CompileRename(bp *schema.Blueprint) []string {
|
||||
return []string{this.GenerateSQL("RENAME TABLE ? TO ?", db.T(bp.GetTable()), db.T(toName))}
|
||||
}
|
||||
|
||||
// 修改表备注
|
||||
func (this Sqlite3) CompileModifyComment(bp *schema.Blueprint) []string {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
func (this Sqlite3) GetColumnModifier(modifier string, bp *schema.Blueprint, column *schema.ColumnDefinition) string {
|
||||
switch modifier {
|
||||
case "Collate":
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"git.fsdpf.net/go/db/v2"
|
||||
"git.fsdpf.net/go/db/v2/engine"
|
||||
"git.fsdpf.net/go/db/v2/schema"
|
||||
"git.fsdpf.net/go/db"
|
||||
"git.fsdpf.net/go/db/engine"
|
||||
"git.fsdpf.net/go/db/schema"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
@@ -68,7 +68,7 @@ func (t *sqlite3Test) TestGetColumnListing() {
|
||||
func (t *sqlite3Test) TestCompileCreate() {
|
||||
bp := schema.NewBlueprint("users")
|
||||
bp.Create()
|
||||
bp.Charset("utf8mb4")
|
||||
bp.Charset = "utf8mb4"
|
||||
|
||||
bp.BigIncrements("id").AutoIncrement().Comment("ID")
|
||||
bp.Boolean("enabled").Default("1").Comment("是否有效")
|
||||
|
||||
Reference in New Issue
Block a user