Repository impl & tests, move tests, comp. pk insert support
Go Tests / test (push) Failing after 8s

This commit is contained in:
2026-05-17 22:44:04 +02:00
parent 1642a01aad
commit e98dbe3338
7 changed files with 357 additions and 5 deletions
+15 -3
View File
@@ -66,7 +66,7 @@ func (t Table) GetInsertDML(count int) (string, error) {
effectiveColumnsLen := 0
for i, col := range t.Columns {
_, ok := col.Modifiers["pk"]
if ok {
if ok && t.IsPkAuto() {
continue
}
@@ -116,7 +116,9 @@ func (t Table) GetUpdateDML() (string, error) {
_, ok := modifiers["pk"]
if ok {
pkColumns = append(pkColumns, col.Name)
continue
if t.IsPkAuto() {
continue
}
}
colDml, err := col.GetUpdateDML()
@@ -129,7 +131,6 @@ func (t Table) GetUpdateDML() (string, error) {
} else {
dml.WriteString(colDml + " ")
}
}
dml.WriteString("WHERE ")
@@ -174,3 +175,14 @@ func (t Table) GetDeleteDML(count int) (string, error) {
return dml.String(), nil
}
func (t Table) IsPkAuto() bool {
for _, constr := range t.Constraints {
if constr.Type != "pk" {
continue
}
return len(constr.Columns) == 1
}
return true
}