engine

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine manages database connections and sessions

func NewEngine

func NewEngine(connectionURL string, cfg EngineConfig) (*Engine, error)

NewEngine creates a new database engine from a SQLAlchemy-style connection URL, e.g. "sqlite+pysqlite:///:memory:" or "postgresql+psycopg2://user:pass@host/db". It opens the underlying database with sql.Open and selects the dialect driver (placeholder/quoting behaviour) based on the URL scheme.

func (*Engine) Close

func (e *Engine) Close() error

Close closes the database connection.

func (*Engine) DB

func (e *Engine) DB() *sql.DB

DB returns the underlying database connection.

func (*Engine) Dialect

func (e *Engine) Dialect() dialect.Dialect

Dialect returns the configured SQL dialect (placeholder/quoting behaviour).

func (*Engine) Logger

func (e *Engine) Logger() *slog.Logger

Logger returns the configured logger (may be nil).

type EngineConfig

type EngineConfig struct {
	Logger *slog.Logger
}

EngineConfig holds engine configuration. Logger is optional and can be used by higher layers to trace SQL statements.

Jump to

Keyboard shortcuts

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