aboutsummaryrefslogtreecommitdiffstats
path: root/internal/storage/adapter.go
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2024-03-10 20:03:50 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2024-03-10 20:03:50 -0400
commitf0ee4ba310f7034f549570a0833ac7ba41e9ab7f (patch)
tree8791281d7c144209d2d3dd1b99e785f294dcdeab /internal/storage/adapter.go
parentUse pgx v5 and update changelog (diff)
downloadcli-f0ee4ba310f7034f549570a0833ac7ba41e9ab7f.zip
Add adapter tests
Diffstat (limited to 'internal/storage/adapter.go')
-rw-r--r--internal/storage/adapter.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/storage/adapter.go b/internal/storage/adapter.go
index ce01989..d4573f0 100644
--- a/internal/storage/adapter.go
+++ b/internal/storage/adapter.go
@@ -3,8 +3,16 @@ package storage
import "github.com/eugenetriguba/bolt/internal/configloader"
type DBAdapter interface {
+ // ConvertGenericPlaceholders replaces any generic `?` placeholders
+ // in `query` for the database driver specific placeholders and returns
+ // the updated query.
ConvertGenericPlaceholders(query string, argsCount int) string
+ // TableExists checks if the tableName exists within the
+ // database currently connected to.
TableExists(executor sqlExecutor, tableName string) (bool, error)
+ // DatabaseName retrieves the currently selected database name.
DatabaseName(executor sqlExecutor) (string, error)
+ // CreateDSN creates a DSN to be used with sql.Open in the database
+ // driver specific format.
CreateDSN(cfg configloader.ConnectionConfig) string
}