update doc and test cases again

This commit is contained in:
Huan Du
2019-04-25 18:56:42 +08:00
parent 6a3f9222bd
commit 254d75df2e
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -269,13 +269,15 @@ fmt.Println(err)
And a sample for PostgreSQL. Note that the dollar quote is supported.
```go
// Only the last `$1` is interpolated.
// Others are not interpolated as they are inside dollar quote (the `$$`).
query, err := PostgreSQL.Interpolate(`
CREATE FUNCTION dup(in int, out f1 int, out f2 text) AS $$
SELECT $1, CAST($1 AS text) || ' is text'
$$
LANGUAGE SQL;
SELECT * FROM dup(42);`, []interface{}{42, 64})
SELECT * FROM dup($1);`, []interface{}{42})
fmt.Println(query)
fmt.Println(err)
+3 -1
View File
@@ -148,13 +148,15 @@ func ExampleFlavor_Interpolate() {
}
func ExampleFlavor_Interpolate_postgreSQL() {
// Only the last `$1` is interpolated.
// Others are not interpolated as they are inside dollar quote (the `$$`).
query, err := PostgreSQL.Interpolate(`
CREATE FUNCTION dup(in int, out f1 int, out f2 text) AS $$
SELECT $1, CAST($1 AS text) || ' is text'
$$
LANGUAGE SQL;
SELECT * FROM dup(42);`, []interface{}{42, 64})
SELECT * FROM dup($1);`, []interface{}{42})
fmt.Println(query)
fmt.Println(err)