コード例 #1
0
func (c context) createDBs() {
	opts := db.BatchCreateOpts{
		db.CreateOpts{Name: "db1"},
		db.CreateOpts{Name: "db2"},
		db.CreateOpts{Name: "db3"},
	}

	err := db.Create(c.client, c.instanceID, opts).ExtractErr()
	c.AssertNoErr(err)
	c.Logf("Created three databases on instance %s: db1, db2, db3", c.instanceID)
}
コード例 #2
0
func TestCreate(t *testing.T) {
	th.SetupHTTP()
	defer th.TeardownHTTP()
	HandleCreate(t)

	opts := databases.BatchCreateOpts{
		databases.CreateOpts{Name: "testingdb", CharSet: "utf8", Collate: "utf8_general_ci"},
		databases.CreateOpts{Name: "sampledb"},
	}

	res := databases.Create(fake.ServiceClient(), instanceID, opts)
	th.AssertNoErr(t, res.Err)
}