2020-04-09 11:15:34 +00:00
|
|
|
package named
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"database/sql"
|
|
|
|
"log"
|
2020-04-08 19:20:23 +00:00
|
|
|
)
|
2020-04-09 11:15:34 +00:00
|
|
|
|
|
|
|
func Insert(ctx context.Context, db *sql.DB) {
|
|
|
|
_, err := db.ExecContext(
|
|
|
|
ctx,
|
|
|
|
"INSERT INTO users(name) VALUES(@name)",
|
|
|
|
sql.Named("name", "Amos Burton"),
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|