1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-12-22 00:36:41 +02:00
crud_generator/vendor/github.com/jackc/pgx/v5/pgconn
2023-12-27 14:28:11 +03:00
..
internal новый 2023-09-28 17:45:44 +03:00
auth_scram.go сделал readme 2023-11-14 17:07:41 +03:00
config.go сделал readme 2023-11-14 17:07:41 +03:00
defaults_windows.go новый 2023-09-28 17:45:44 +03:00
defaults.go новый 2023-09-28 17:45:44 +03:00
doc.go новый 2023-09-28 17:45:44 +03:00
errors.go новый 2023-09-28 17:45:44 +03:00
krb5.go новый 2023-09-28 17:45:44 +03:00
pgconn.go сделал make mod 2023-12-27 14:28:11 +03:00
README.md новый 2023-09-28 17:45:44 +03:00

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.