MCPcopy
hub / github.com/jmoiron/sqlx / loadDefaultFixture

Function loadDefaultFixture

sqlx_test.go:244–260  ·  sqlx_test.go::loadDefaultFixture
(db *DB, t *testing.T)

Source from the content-addressed store, hash-verified

242}
243
244func loadDefaultFixture(db *DB, t *testing.T) {
245 tx := db.MustBegin()
246 tx.MustExec(tx.Rebind("INSERT INTO person (first_name, last_name, email) VALUES (?, ?, ?)"), "Jason", "Moiron", "jmoiron@jmoiron.net")
247 tx.MustExec(tx.Rebind("INSERT INTO person (first_name, last_name, email) VALUES (?, ?, ?)"), "John", "Doe", "johndoeDNE@gmail.net")
248 tx.MustExec(tx.Rebind("INSERT INTO place (country, city, telcode) VALUES (?, ?, ?)"), "United States", "New York", "1")
249 tx.MustExec(tx.Rebind("INSERT INTO place (country, telcode) VALUES (?, ?)"), "Hong Kong", "852")
250 tx.MustExec(tx.Rebind("INSERT INTO place (country, telcode) VALUES (?, ?)"), "Singapore", "65")
251 if db.DriverName() == "mysql" {
252 tx.MustExec(tx.Rebind("INSERT INTO capplace (`COUNTRY`, `TELCODE`) VALUES (?, ?)"), "Sarf Efrica", "27")
253 } else {
254 tx.MustExec(tx.Rebind("INSERT INTO capplace (\"COUNTRY\", \"TELCODE\") VALUES (?, ?)"), "Sarf Efrica", "27")
255 }
256 tx.MustExec(tx.Rebind("INSERT INTO employees (name, id) VALUES (?, ?)"), "Peter", "4444")
257 tx.MustExec(tx.Rebind("INSERT INTO employees (name, id, boss_id) VALUES (?, ?, ?)"), "Joe", "1", "4444")
258 tx.MustExec(tx.Rebind("INSERT INTO employees (name, id, boss_id) VALUES (?, ?, ?)"), "Martin", "2", "4444")
259 tx.Commit()
260}
261
262// Test a new backwards compatible feature, that missing scan destinations
263// will silently scan into sql.RawText rather than failing/panicing

Callers 12

TestNamedContextQueriesFunction · 0.85
TestNamedQueriesFunction · 0.85
TestMissingNamesFunction · 0.85
TestEmbeddedStructsFunction · 0.85
TestJoinQueryFunction · 0.85
TestSelectSliceMapTimeFunction · 0.85
TestNilReceiverFunction · 0.85
TestMultiInsertFunction · 0.85
TestUsageFunction · 0.85
TestInFunction · 0.85
TestSelectResetFunction · 0.85

Calls 4

MustBeginMethod · 0.80
RebindMethod · 0.65
DriverNameMethod · 0.65
MustExecMethod · 0.45

Tested by

no test coverage detected