pgx Questions

1

Solved

I am developing a simple Go service to connect to a database for basic querying. I am using sqlc to generate the Go functions to interact with the DB. when switching the driver from lib/pq to pgx/v...
Payment asked 24/10, 2023 at 18:4

4

Solved

We are using a user struct with alot of fields as follow : type user struct { ID int `json:"id,omitempty"` UUID string `json:"uuid,omitempty"` Role int `json:"role,omitempty"` Name string `js...
Gyrostat asked 9/5, 2020 at 22:51

2

I'm using sqlc and pgx/v5, and getting the below error for a postgres array of a user defined enum type: Error: can't scan into dest[1]: cannot scan unknown type (OID 16385) in text format into *pg...
Electronarcosis asked 6/2, 2023 at 18:56

3

I couldn't find it documentation how to log sql queries if I use pgx pool. For example I have created pool like this: func DB() *pgxpool.Pool { connStr := os.Getenv("DATABASE_URL") conn...
Dutcher asked 23/10, 2020 at 17:40

0

I want to scan in an array of strings using the pgx library without using pq ideally. Is there a way of doing this: sourceKeys := make([]string, 0, 1) err := rows.Scan( pq.Array(&sourceKeys), ...
Ruthenic asked 1/4, 2022 at 0:1

2

Solved

I am trying to bulk insert keys in db in go here is the code Key Struct type tempKey struct { keyVal string lastKey int } Test Keys data := []tempKey{ {keyVal: "abc", lastKey: 10}, {ke...
Blok asked 23/1, 2022 at 14:30

1

Solved

I have the following code for connecting to a Postgres database: func connectToPostgres(ctx context.Context, url string) (*pgxpool.Pool, error) { var err error for i := 0; i < 5; i++ { p, err...
Illhumored asked 21/12, 2021 at 17:15

2

Solved

I am trying to do csv import and export data with postgresql (where the data base is at a remote host). Normally I would use the psql command to do \copy <table> from <local path> ... a...
Alvera asked 9/8, 2021 at 6:30

1

Solved

I'm using PostgreSQL with , and I'm trying to run a SELECT * FROM query in Pgx. I can't seem to get the iteration down, as it only returns the last key in the table. I'm also trying to serve this a...
Mcauliffe asked 30/3, 2021 at 1:39

2

Solved

Hey I'm getting an error message : conn busy from pgx I don't know how to solve this. Here is my function : func (r *proverbRepo) SelectPendingProverbs(table string) (proverbs []domain.Proverb, e...
Xanthate asked 28/10, 2019 at 20:1

0

New at pgx. Using pgxpool. I have a simple Query var result string err := Conn.QueryRow(context.Background(), `SELECT name FROM table WHERE id=1000`).Scan(&result) if err != nil { if err == ...
Practicable asked 3/10, 2020 at 14:42

1

Solved

Introduction database/sql In the Go standard sql library, the *Stmt type has methods defined like: func (s *Stmt) Exec(args ...interface{}) (Result, error) func (s *Stmt) Query(args ...interface...
Chiccory asked 10/2, 2019 at 18:30
1

© 2022 - 2024 — McMap. All rights reserved.