示例#1
0
文件: db.go 项目: rjp/crud
func (db *DB) DropTable(st interface{}, ifexists bool) error {
	t, err := NewTable(st)
	if err != nil {
		return err
	}

	_, err = db.Exec(sql.DropTableQuery(t.SQLName, true))
	return err
}
示例#2
0
文件: table_test.go 项目: rjp/crud
func TestDropTableQuery(t *testing.T) {
	assert.Equal(t, sql.DropTableQuery("yolo", false), "DROP TABLE yolo")
	assert.Equal(t, sql.DropTableQuery("yolo", true), "DROP TABLE IF EXISTS yolo")
}