Make all text fit sql slides

This commit is contained in:
Ilya Sinelnikov 2021-04-08 14:37:21 +03:00
parent 38478f189a
commit e1cf5d8de3
7 changed files with 32 additions and 28 deletions

View file

@ -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)
}

View file

@ -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
}

View file

@ -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

View file

@ -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)
}