add Alterable function for gdb.Model
@@ -175,6 +175,23 @@ func TestModel_Clone(t *testing.T) {
gtest.Assert(result[1]["id"].Int(), 3)
}
+func TestModel_Alterable(t *testing.T) {
+ gtest.Case(t, func() {
+ md := db.Table("user").Alterable().Where("id IN(?)", g.Slice{1,3})
+ count, err := md.Count()
+ if err != nil {
+ gtest.Fatal(err)
+ }
+ gtest.Assert(count, 2)
+ md.And("id = ?", 1)
+ count, err = md.Count()
+ if err != nil {
+ gtest.Fatal(err)
+ }
+ gtest.Assert(count, 1)
+ })
+}
+
func TestModel_All(t *testing.T) {
result, err := db.Table("user").All()
if err != nil {
