| 23 | ) |
| 24 | |
| 25 | func 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 | |
| 43 | func Example_iam() { |
| 44 | // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored. |