summaryrefslogtreecommitdiff
path: root/vendor/github.com/testcontainers/testcontainers-go/modules/postgres/options.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/testcontainers/testcontainers-go/modules/postgres/options.go')
-rw-r--r--vendor/github.com/testcontainers/testcontainers-go/modules/postgres/options.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/github.com/testcontainers/testcontainers-go/modules/postgres/options.go b/vendor/github.com/testcontainers/testcontainers-go/modules/postgres/options.go
new file mode 100644
index 0000000..5779f85
--- /dev/null
+++ b/vendor/github.com/testcontainers/testcontainers-go/modules/postgres/options.go
@@ -0,0 +1,39 @@
+package postgres
+
+import (
+ "github.com/testcontainers/testcontainers-go"
+)
+
+type options struct {
+ // SQLDriverName is the name of the SQL driver to use.
+ SQLDriverName string
+ Snapshot string
+}
+
+func defaultOptions() options {
+ return options{
+ SQLDriverName: "postgres",
+ Snapshot: defaultSnapshotName,
+ }
+}
+
+// Compiler check to ensure that Option implements the testcontainers.ContainerCustomizer interface.
+var _ testcontainers.ContainerCustomizer = (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.ContainerCustomizer interface.
+func (o Option) Customize(*testcontainers.GenericContainerRequest) 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
+ }
+}