aboutsummaryrefslogtreecommitdiff
path: root/lib/sql
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2021-02-10 15:28:35 +0700
committerShulhan <m.shulhan@gmail.com>2021-02-10 15:28:35 +0700
commitf39924895794ca680bc904c5a980de39e23fa66e (patch)
tree6b7521ce2febb8776462f1ae9b3c96bc3f3bf7d7 /lib/sql
parent093c8bee603ce8d3f6f248975d52a1fc45f0f50f (diff)
downloadpakakeh.go-f39924895794ca680bc904c5a980de39e23fa66e.tar.xz
sql: print the values from the first example ExtractSQLFields
This is to give an overview what the values hold after the call.
Diffstat (limited to 'lib/sql')
-rw-r--r--lib/sql/row_example_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sql/row_example_test.go b/lib/sql/row_example_test.go
index e22524a4..0bd492cf 100644
--- a/lib/sql/row_example_test.go
+++ b/lib/sql/row_example_test.go
@@ -17,6 +17,9 @@ func ExampleRow_ExtractSQLFields() {
q := `INSERT INTO table (` + fnames + `) VALUES (` + fholders + `)`
fmt.Printf("Query: %s\n", q)
+ // err := db.Exec(q, values...)
+ fmt.Println(values)
+
names, holders, values = row.ExtractSQLFields("postgres")
fnames = strings.Join(names, ",")
fholders = strings.Join(holders, ",")
@@ -28,6 +31,7 @@ func ExampleRow_ExtractSQLFields() {
// Output:
// Query: INSERT INTO table (col_1,col_2,col_3) VALUES (?,?,?)
+ // [true 1 'update']
// Query for PostgreSQL: INSERT INTO table (col_1,col_2,col_3) VALUES ($1,$2,$3)
// [true 1 'update']
}