-
-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* main: chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.2.1 (#2617) chore(deps): bump peter-evans/slash-command-dispatch from 3.0.2 to 4.0.0 (#2561) docs: document ryuk timeouts for compose (#2620) chore: use self-hosted worker for Windows tests (#2619) feat(postgres): use faster sql.DB instead of docker exec psql for snapshot/restore [rebased for main] (#2600)
- Loading branch information
Showing
14 changed files
with
329 additions
and
768 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package postgres | ||
|
||
import ( | ||
"github.com/testcontainers/testcontainers-go" | ||
) | ||
|
||
type options struct { | ||
// SQLDriverName is the name of the SQL driver to use. | ||
SQLDriverName string | ||
} | ||
|
||
func defaultOptions() options { | ||
return options{ | ||
SQLDriverName: "postgres", | ||
} | ||
} | ||
|
||
// Compiler check to ensure that Option implements the testcontainers.RequestCustomizer interface. | ||
var _ testcontainers.RequestCustomizer = (Option)(nil) | ||
|
||
// Option is an option for the Redpanda container. | ||
type Option func(*options) | ||
|
||
// Customize is a NOOP. It's defined to satisfy the testcontainers.RequestCustomizer interface. | ||
func (o Option) Customize(*testcontainers.Request) error { | ||
// NOOP to satisfy interface. | ||
return nil | ||
} | ||
|
||
// WithSQLDriver sets the SQL driver to use for the container. | ||
// It is passed to sql.Open() to connect to the database when making or restoring snapshots. | ||
// This can be set if your app imports a different postgres driver, f.ex. "pgx" | ||
func WithSQLDriver(driver string) Option { | ||
return func(o *options) { | ||
o.SQLDriverName = driver | ||
} | ||
} |
Oops, something went wrong.