sqlite

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLiteAdapter

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

SQLiteAdapter implements the thing.DBAdapter interface for SQLite.

func NewSQLiteAdapter

func NewSQLiteAdapter(dsn string) (*SQLiteAdapter, error)

NewSQLiteAdapter creates a new SQLite database adapter. Implements the public DBAdapter interface.

func (*SQLiteAdapter) BeginTx

func (a *SQLiteAdapter) BeginTx(ctx context.Context, opts *sql.TxOptions) (thing.Tx, error)

BeginTx starts a new database transaction.

func (*SQLiteAdapter) Builder

func (a *SQLiteAdapter) Builder() thing.SQLBuilder

func (*SQLiteAdapter) Close

func (a *SQLiteAdapter) Close() error

Close closes the database connection pool.

func (*SQLiteAdapter) DB

func (a *SQLiteAdapter) DB() *sql.DB

DB returns the underlying *sql.DB for advanced use cases.

func (*SQLiteAdapter) DialectName

func (a *SQLiteAdapter) DialectName() string

func (*SQLiteAdapter) Exec

func (a *SQLiteAdapter) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

Exec executes a query that doesn't return rows (INSERT, UPDATE, DELETE). Uses standard sql.DB.ExecContext

func (*SQLiteAdapter) Get

func (a *SQLiteAdapter) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error

Get retrieves a single row and scans it into the destination struct. Uses QueryContext and prepares scan destinations based on returned columns.

func (*SQLiteAdapter) GetCount

func (a *SQLiteAdapter) GetCount(ctx context.Context, tableName string, where string, args []interface{}) (int64, error)

GetCount executes a SELECT COUNT(*) query based on the provided parameters.

func (*SQLiteAdapter) Select

func (a *SQLiteAdapter) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error

Select executes a query and scans the results into a slice. Dynamically creates scan destinations based on query columns.

type SQLiteDialector

type SQLiteDialector struct{}

SQLiteDialector implements the sqlbuilder.Dialector interface for SQLite.

func (SQLiteDialector) Placeholder

func (d SQLiteDialector) Placeholder(_ int) string

func (SQLiteDialector) Quote

func (d SQLiteDialector) Quote(identifier string) string

type SQLiteIntrospector

type SQLiteIntrospector struct {
	DB *sql.DB
}

SQLiteIntrospector implements schema.Introspector for SQLite.

func (*SQLiteIntrospector) GetTableInfo

func (si *SQLiteIntrospector) GetTableInfo(ctx context.Context, tableName string) (*schema.TableInfo, error)

GetTableInfo introspects the given table and returns its schema info (SQLite).

type SQLiteTx

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

SQLiteTx wraps a standard sql.Tx to implement the interfaces.Tx interface.

func (*SQLiteTx) Commit

func (t *SQLiteTx) Commit() error

Commit commits the transaction.

func (*SQLiteTx) Exec

func (t *SQLiteTx) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

Exec executes a query within the transaction that doesn't return rows.

func (*SQLiteTx) Get

func (t *SQLiteTx) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error

Get retrieves a single row within the transaction. Uses QueryContext and prepares scan destinations based on returned columns.

func (*SQLiteTx) Rollback

func (t *SQLiteTx) Rollback() error

Rollback rolls back the transaction.

func (*SQLiteTx) Select

func (t *SQLiteTx) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error

Select executes a query within the transaction and scans results into a slice. Dynamically creates scan destinations based on query columns.

Jump to

Keyboard shortcuts

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