getRDSConnectionConfig returns connection config for AWS RDS. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Connecting.Go.html
(ctx context.Context, conf db.ConnectionConfig)
| 252 | // |
| 253 | // https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Connecting.Go.html |
| 254 | func getRDSConnectionConfig(ctx context.Context, conf db.ConnectionConfig) (*pgx.ConnConfig, error) { |
| 255 | password, err := getRDSConnectionPassword(ctx, conf) |
| 256 | if err != nil { |
| 257 | return nil, err |
| 258 | } |
| 259 | |
| 260 | dsn := fmt.Sprintf("host=%s port=%s user=%s password=%s", |
| 261 | conf.DataSource.Host, conf.DataSource.Port, conf.DataSource.Username, password, |
| 262 | ) |
| 263 | config, err := pgx.ParseConfig(dsn) |
| 264 | if err != nil { |
| 265 | return nil, err |
| 266 | } |
| 267 | config.DefaultQueryExecMode = pgx.QueryExecModeExec |
| 268 | config.StatementCacheCapacity = 0 |
| 269 | return config, nil |
| 270 | } |
| 271 | |
| 272 | // getCloudSQLConnectionConfig returns config for Cloud SQL connector. |
| 273 | // refs: |
no test coverage detected