db

package
v0.0.0-...-baea68c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SQLiteDriver = "sqlite3"
)

Variables

This section is empty.

Functions

func CreateDBPool

func CreateDBPool(driver, dsn string, cfg *ConnConfig) (*sql.DB, error)

func GetROConnection

func GetROConnection(ctx context.Context) *sql.DB

func GetRWConnection

func GetRWConnection(ctx context.Context) *sql.DB

func NewDataServerManagerContext

func NewDataServerManagerContext(ctx context.Context, m *Manager) context.Context

func SQLiteSchemaPath

func SQLiteSchemaPath(ctx context.Context) string

func SQLiteSchemaProvider

func SQLiteSchemaProvider(ctx context.Context) string

Types

type ConnConfig

type ConnConfig struct {
	// contains filtered or unexported fields
}

func NewConnConfig

func NewConnConfig(opts ...ConnOptions) *ConnConfig

type ConnOptions

type ConnOptions func(*ConnConfig)

type Connection

type Connection struct {
	Type ConnectionType
	// contains filtered or unexported fields
}

func ROConnPoolProvider

func ROConnPoolProvider(ctx context.Context) *Connection

func RWConnPoolProvider

func RWConnPoolProvider(ctx context.Context) *Connection

type ConnectionType

type ConnectionType string

type DSNConfig

type DSNConfig struct {
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(opts ...DSNOptions) *DSNConfig

func (*DSNConfig) DSN

func (dc *DSNConfig) DSN() (string, bool)

type DSNOptions

type DSNOptions func(*DSNConfig)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager supports connection to only one SQLite DB

func DataServerManagerFromContext

func DataServerManagerFromContext(ctx context.Context) (*Manager, bool)

DataServerManagerFromContext extracts the db manager instance from the given context.

func NewManager

func NewManager(ctx context.Context) *Manager

func (*Manager) GetDBConnection

func (m *Manager) GetDBConnection(ctype ConnectionType) *sql.DB

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL