I make a choice in Go using database / sql and pq Postgres driver:
rows, err := db.Query("SELECT (name, age) FROM people WHERE id = 1")
I tried to restore the values ββin the usual way:
rows.Next()
name := ""
age := 0
err = rows.Scan(&name, &age)
but I got an error:
sql: expected 1 destination arguments in Scan, not 2
Documentation for sql. (* Rows) .Scan says that you can pass a pointer to a piece of byte, and it will be filled with raw Results. So I did this:
b := make([]byte, 1024*1024)
rows.Scan(&b)
fmt.Println(string(b))
who succeeded, seal:
(John,18)
, sql. (* Rows).Scan, , , , ( ). - pq, , . ?