Documentation
¶
Overview ¶
Package sqlite provides the SQLite database driver implementation.
Index ¶
- func NewSQLiteDriver() database.DatabaseDriver
- type SQLiteDriver
- func (d *SQLiteDriver) BeginTx(ctx context.Context) (database.Transaction, error)
- func (d *SQLiteDriver) Close() error
- func (d *SQLiteDriver) Connect(ctx context.Context, dsn string) error
- func (d *SQLiteDriver) CreateTable(schema database.TableSchema) (database.Query, error)
- func (d *SQLiteDriver) Delete(table string, where string, whereArgs ...interface{}) (database.Query, error)
- func (d *SQLiteDriver) DropTable(tableName string) (database.Query, error)
- func (d *SQLiteDriver) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (d *SQLiteDriver) Insert(table string, data map[string]interface{}) (database.Query, error)
- func (d *SQLiteDriver) MapType(schemaType string) string
- func (d *SQLiteDriver) Ping(ctx context.Context) error
- func (d *SQLiteDriver) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (d *SQLiteDriver) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (d *SQLiteDriver) Select(table string, columns []string, where string, whereArgs ...interface{}) (database.Query, error)
- func (d *SQLiteDriver) SupportsArrays() bool
- func (d *SQLiteDriver) SupportsLastInsertId() bool
- func (d *SQLiteDriver) SupportsReturning() bool
- func (d *SQLiteDriver) TableExists(tableName string) (bool, error)
- func (d *SQLiteDriver) Update(table string, data map[string]interface{}, where string, ...) (database.Query, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSQLiteDriver ¶
func NewSQLiteDriver() database.DatabaseDriver
NewSQLiteDriver creates a new SQLite driver.
Types ¶
type SQLiteDriver ¶
type SQLiteDriver struct {
// contains filtered or unexported fields
}
SQLiteDriver implements the DatabaseDriver interface for SQLite.
func (*SQLiteDriver) BeginTx ¶
func (d *SQLiteDriver) BeginTx(ctx context.Context) (database.Transaction, error)
BeginTx starts a new transaction.
func (*SQLiteDriver) Close ¶
func (d *SQLiteDriver) Close() error
Close closes the database connection.
func (*SQLiteDriver) Connect ¶
func (d *SQLiteDriver) Connect(ctx context.Context, dsn string) error
Connect establishes a connection to SQLite.
func (*SQLiteDriver) CreateTable ¶
func (d *SQLiteDriver) CreateTable(schema database.TableSchema) (database.Query, error)
CreateTable generates and returns a CREATE TABLE query for SQLite.
func (*SQLiteDriver) Delete ¶
func (d *SQLiteDriver) Delete(table string, where string, whereArgs ...interface{}) (database.Query, error)
Delete generates a DELETE query.
func (*SQLiteDriver) DropTable ¶
func (d *SQLiteDriver) DropTable(tableName string) (database.Query, error)
DropTable generates a DROP TABLE query.
func (*SQLiteDriver) Exec ¶
func (d *SQLiteDriver) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
Exec executes a query without returning rows.
func (*SQLiteDriver) Insert ¶
Insert generates an INSERT query with RETURNING support (SQLite 3.35+).
func (*SQLiteDriver) MapType ¶
func (d *SQLiteDriver) MapType(schemaType string) string
MapType maps schema types to SQLite types.
func (*SQLiteDriver) Ping ¶
func (d *SQLiteDriver) Ping(ctx context.Context) error
Ping checks if the connection is alive.
func (*SQLiteDriver) Query ¶
func (d *SQLiteDriver) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
Query executes a query that returns rows.
func (*SQLiteDriver) Select ¶
func (d *SQLiteDriver) Select(table string, columns []string, where string, whereArgs ...interface{}) (database.Query, error)
Select generates a SELECT query.
func (*SQLiteDriver) SupportsArrays ¶
func (d *SQLiteDriver) SupportsArrays() bool
SupportsArrays returns false for SQLite.
func (*SQLiteDriver) SupportsLastInsertId ¶
func (d *SQLiteDriver) SupportsLastInsertId() bool
SupportsLastInsertId returns true for SQLite.
func (*SQLiteDriver) SupportsReturning ¶
func (d *SQLiteDriver) SupportsReturning() bool
SupportsReturning returns true for SQLite 3.35+.
func (*SQLiteDriver) TableExists ¶
func (d *SQLiteDriver) TableExists(tableName string) (bool, error)
TableExists checks if a table exists.