func insertUnprepared(e execer, actionNum int) error { sql := ` insert into widgets(name, description, creation_time) values($1, $2, $3)` _, err := e.Exec(sql, fake.ProductName(), fake.Sentences(), time.Now()) return err }
func txInsertRollback(pool *pgx.ConnPool, actionNum int) error { tx, err := pool.Begin() if err != nil { return err } sql := ` insert into widgets(name, description, creation_time) values($1, $2, $3)` _, err = tx.Exec(sql, fake.ProductName(), fake.Sentences(), time.Now()) if err != nil { return err } return tx.Rollback() }