mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 21:02:26 -05:00
- github.com/jackc/pgx/v5 v5.7.5 -> v5.7.6 - github.com/ncruces/go-sqlite3 v0.28.0 -> v0.29.0 - github.com/tdewolff/minify/v2 v2.24.2 -> v2.24.3 - golang.org/x/oauth2 v0.30.0 -> v0.31.0 - golang.org/x/sys v0.35.0 -> v0.36.0 - golang.org/x/text v0.28.0 -> v0.29.0 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4422 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com> |
||
|---|---|---|
| .. | ||
| ctxwatch | ||
| internal/bgreader | ||
| auth_scram.go | ||
| config.go | ||
| defaults.go | ||
| defaults_windows.go | ||
| doc.go | ||
| errors.go | ||
| krb5.go | ||
| pgconn.go | ||
| README.md | ||
pgconn
Package pgconn is a low-level PostgreSQL database driver. It operates at nearly the same level as the C library libpq. It is primarily intended to serve as the foundation for higher level libraries such as https://github.com/jackc/pgx. Applications should handle normal queries with a higher level library and only use pgconn directly when required for low-level access to PostgreSQL functionality.
Example Usage
pgConn, err := pgconn.Connect(context.Background(), os.Getenv("DATABASE_URL"))
if err != nil {
log.Fatalln("pgconn failed to connect:", err)
}
defer pgConn.Close(context.Background())
result := pgConn.ExecParams(context.Background(), "SELECT email FROM users WHERE id=$1", [][]byte{[]byte("123")}, nil, nil, nil)
for result.NextRow() {
fmt.Println("User 123 has email:", string(result.Values()[0]))
}
_, err = result.Close()
if err != nil {
log.Fatalln("failed reading result:", err)
}
Testing
See CONTRIBUTING.md for setup instructions.