Skip to content

Commit acdb8ba

Browse files
authored
[PECO-1124] Update the docs for Go for Parameterized Queries and Staging Ingestion (#170)
We need to update the doc to teach users how to use these features.
2 parents 6bb1879 + 28637be commit acdb8ba

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

doc.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,25 @@ Use the driverctx package under driverctx/ctx.go to add callbacks to the query c
184184
185185
}
186186
187+
# Query parameters
188+
189+
Passing parameters to a query is supported when run against servers with version DBR 14.1.
190+
191+
p := dbsql.Parameter{Name: "p_bool", Value: true},
192+
rows, err1 := db.QueryContext(ctx, `select * from sometable where condition=:p_bool`,dbsql.Parameter{Name: "p_bool", Value: true})
193+
194+
For complex types, you can specify the SQL type using the dbsql.Parameter type field. If this field is set, the value field MUST be set to a string.
195+
196+
# Staging Ingestion
197+
198+
The Go driver now supports staging operations. In order to use a staging operation, you first must update the context with a list of folders that you are allowing the driver to access.
199+
200+
ctx := driverctx.NewContextWithStagingInfo(context.Background(), []string{"staging/"})
201+
202+
After doing so, you can execute staging operations using this context using the exec context.
203+
204+
_, err1 := db.ExecContext(ctx, `PUT 'staging/file.csv' INTO '/Volumes/main/staging_test/e2etests/file.csv' OVERWRITE`)
205+
187206
# Errors
188207
189208
There are three error types exposed via dbsql/errors

0 commit comments

Comments
 (0)