Repository impl & tests, move tests, comp. pk insert support
Go Tests / test (push) Failing after 8s
Go Tests / test (push) Failing after 8s
This commit is contained in:
+15
-3
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user