Make all text fit sql slides
This commit is contained in:
parent
38478f189a
commit
e1cf5d8de3
7 changed files with 32 additions and 28 deletions
|
@ -7,7 +7,11 @@ import (
|
|||
)
|
||||
|
||||
func Exec(ctx context.Context, db *sql.DB) {
|
||||
res, err := db.ExecContext(ctx, "UPDATE users SET name = $1 WHERE id = $2", "William Mandella", 1)
|
||||
res, err := db.ExecContext(
|
||||
ctx,
|
||||
"UPDATE users SET name = $1 WHERE id = $2",
|
||||
"William Mandella", 1,
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ func Open() {
|
|||
dbFoo, _ := sql.Open("pgx", "host=foo")
|
||||
dbBar, _ := sql.Open("pgx", "host=bar")
|
||||
cluster, err := hasql.NewCluster(
|
||||
[]hasql.Node{hasql.NewNode("foo", dbFoo), hasql.NewNode("bar", dbBar) },
|
||||
[]hasql.Node{hasql.NewNode("foo", dbFoo), hasql.NewNode("bar", dbBar)},
|
||||
checkers.PostgreSQL,
|
||||
)
|
||||
if err != nil {
|
||||
|
|
|
@ -13,7 +13,8 @@ func TxExhaust(ctx context.Context, db *sql.DB) {
|
|||
return
|
||||
}
|
||||
|
||||
if _, err = tx.ExecContext(ctx, `UPDATE users SET name = "Surl/Tesh-echer" WHERE id = 1`); err != nil {
|
||||
_, err = tx.ExecContext(ctx, `UPDATE users SET name = "Surl/Tesh-echer" WHERE id = 1`)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -100,16 +100,14 @@ database/sql
|
|||
|
||||
.code prepare/prepare.go /^func Prepare/,/^}/
|
||||
|
||||
* *sql.DB - это пул коннектов
|
||||
|
||||
* Настройка DB
|
||||
* Настройка *sql.DB
|
||||
|
||||
- func (db *DB) SetConnMaxIdleTime(d time.Duration)
|
||||
- func (db *DB) SetConnMaxLifetime(d time.Duration)
|
||||
- func (db *DB) SetMaxIdleConns(n int)
|
||||
- func (db *DB) SetMaxOpenConns(n int)
|
||||
|
||||
* Статистика DB
|
||||
* Статистика *sql.DB
|
||||
|
||||
- func (db *DB) Stats() DBStats
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ func Begin(ctx context.Context, db *sql.DB) {
|
|||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
if _, err = tx.ExecContext(ctx, `UPDATE users SET name = "Tyador Borlú" WHERE id = 1`); err != nil {
|
||||
_, err = tx.ExecContext(ctx, `UPDATE users SET name = "Tyador Borlú" WHERE id = 1`)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue