gorm/clause/delete_test.go

32 lines
608 B
Go
Raw Permalink Normal View History

2020-02-07 18:45:35 +03:00
package clause_test
import (
"fmt"
"testing"
2020-06-02 04:16:07 +03:00
"gorm.io/gorm/clause"
2020-02-07 18:45:35 +03:00
)
func TestDelete(t *testing.T) {
results := []struct {
Clauses []clause.Interface
Result string
Vars []interface{}
}{
{
[]clause.Interface{clause.Delete{}, clause.From{}},
"DELETE FROM `users`", nil,
},
{
[]clause.Interface{clause.Delete{Modifier: "LOW_PRIORITY"}, clause.From{}},
"DELETE LOW_PRIORITY FROM `users`", nil,
},
}
for idx, result := range results {
t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) {
checkBuildClauses(t, result.Clauses, result.Result, result.Vars)
})
}
}