aboutsummaryrefslogtreecommitdiffstats
path: root/internal/storage/adapter.go
blob: d4573f0bb126dbdbc7c8e1557836c6908d80f311 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
}