MCPcopy Create free account
hub / github.com/google/go-cloud / Example

Function Example

postgres/awspostgres/example_test.go:25–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23)
24
25func Example() {
26 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.
27 // PRAGMA: On gocloud.dev, add a blank import: _ "gocloud.dev/postgres/awspostgres"
28 // PRAGMA: On gocloud.dev, hide lines until the next blank line.
29 ctx := context.Background()
30
31 // Replace these with your actual settings.
32 db, err := postgres.Open(ctx,
33 "awspostgres://myrole:swordfish@example01.xyzzy.us-west-1.rds.amazonaws.com/testdb")
34 if err != nil {
35 log.Fatal(err)
36 }
37 defer db.Close()
38
39 // Use database in your program.
40 db.ExecContext(ctx, "CREATE TABLE foo (bar INT);")
41}
42
43func Example_iam() {
44 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.

Callers

nothing calls this directly

Calls 2

OpenFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected