MCPcopy Index your code
hub / github.com/Masterminds/structable / TestExists

Function TestExists

structable_test.go:243–257  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

241}
242
243func TestExists(t *testing.T) {
244 stool := newStool()
245 db := &DBStub{}
246 r := New(db, "mysql").Bind("test_table", stool)
247
248 _, err := r.Exists()
249 if err != nil {
250 t.Errorf("Error calling Exists: %s", err)
251 }
252
253 expect := "SELECT COUNT(*) > 0 FROM test_table WHERE id = ? AND id_two = ?"
254 if db.LastQueryRowSql != expect {
255 t.Errorf("Unexpected SQL: %s", db.LastQueryRowSql)
256 }
257}
258
259func TestActiveRecord(t *testing.T) {
260 db := &DBStub{}

Callers

nothing calls this directly

Calls 4

newStoolFunction · 0.85
NewFunction · 0.85
BindMethod · 0.65
ExistsMethod · 0.65

Tested by

no test coverage detected