db

package
v0.0.0-...-abce128 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectoryPerm = 0o755
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Open() error
	Close() error
	GetDB() Driver
	BeginTx() (*sql.Tx, error)
}

func NewSQLiteAdapter

func NewSQLiteAdapter(dbPath, schema string) Adapter

NewSQLiteAdapter creates a new SQLite adapter

type DatabaseConnectionError

type DatabaseConnectionError struct {
	InnerError error
	DBFilePath string
}

func (*DatabaseConnectionError) Error

func (e *DatabaseConnectionError) Error() string

type DatabaseDirectoryCreationError

type DatabaseDirectoryCreationError struct {
	InnerError error
	Directory  string
}

func (*DatabaseDirectoryCreationError) Error

type DatabaseNotFoundError

type DatabaseNotFoundError struct {
	DBFilePath string
}

func (*DatabaseNotFoundError) Error

func (e *DatabaseNotFoundError) Error() string

type Driver

type Driver interface {
	Ping() error
	Exec(query string, args ...any) (sql.Result, error)
	Query(query string, args ...any) (*sql.Rows, error)
	QueryRow(query string, args ...any) *sql.Row
}

type QueryExecutionError

type QueryExecutionError struct {
	InnerError error
	DBFilePath string
	Query      string
}

func (*QueryExecutionError) Error

func (e *QueryExecutionError) Error() string

type SQLiteAdapter

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

SQLiteAdapter represents a connection to a SQLite database

func (*SQLiteAdapter) BeginTx

func (a *SQLiteAdapter) BeginTx() (*sql.Tx, error)

BeginTx starts a new transaction

func (*SQLiteAdapter) Close

func (a *SQLiteAdapter) Close() error

Close closes the database connection

func (*SQLiteAdapter) GetDB

func (a *SQLiteAdapter) GetDB() Driver

GetDB returns the database connection

func (*SQLiteAdapter) Open

func (a *SQLiteAdapter) Open() error

Open opens the database connection and initializes the schema if needed

type SchemaInitializationError

type SchemaInitializationError struct {
	InnerError error
	DBFilePath string
}

func (*SchemaInitializationError) Error

func (e *SchemaInitializationError) Error() string

Jump to

Keyboard shortcuts

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