Documentation
¶
Overview ¶
Package sqlite implements the dialects.Dialect interface for SQLite.
Importing the package registers the dialect with dialects.Register under both the "sqlite3" and "sqlite" driver names. New returns a dialect backed by SQLiteCore, and Config describes how to connect to a SQLite database file.
Index ¶
- func New() dialects.Dialect
- func UseSQLite()
- type Config
- type SQLiteCore
- func (*SQLiteCore) AutoIncrement() string
- func (*SQLiteCore) Binding() string
- func (*SQLiteCore) CurrentTime() string
- func (*SQLiteCore) DataType(t dialects.DataType) string
- func (s *SQLiteCore) Escape(v any) string
- func (s *SQLiteCore) Features() dialects.Features
- func (*SQLiteCore) Identifier(s string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Path string
}
Config describes how to connect to a SQLite database. Path is the path to the database file.
func (*Config) DataSourceName ¶
DataSourceName returns the path to the SQLite database file.
func (*Config) DriverName ¶
DriverName returns the database driver name, "sqlite3".
type SQLiteCore ¶
type SQLiteCore struct{}
SQLiteCore implements generic.Core for SQLite. It quotes identifiers with double quotes, uses ? bindings, and supports RETURNING.
func (*SQLiteCore) AutoIncrement ¶
func (*SQLiteCore) AutoIncrement() string
AutoIncrement returns the clause that makes a column an auto-incrementing primary key in SQLite.
func (*SQLiteCore) Binding ¶
func (*SQLiteCore) Binding() string
Binding returns the SQLite binding placeholder.
func (*SQLiteCore) CurrentTime ¶
func (*SQLiteCore) CurrentTime() string
CurrentTime returns the SQLite expression for the current timestamp.
func (*SQLiteCore) DataType ¶
func (*SQLiteCore) DataType(t dialects.DataType) string
DataType maps a dialects.DataType to a SQLite column type.
func (*SQLiteCore) Escape ¶
func (s *SQLiteCore) Escape(v any) string
Escape renders v as a SQL literal, doubling embedded single quotes in strings and rendering values that implement encoding.TextMarshaler as their marshaled text.
func (*SQLiteCore) Features ¶
func (s *SQLiteCore) Features() dialects.Features
Features reports the capabilities supported by SQLite, which include RETURNING.
func (*SQLiteCore) Identifier ¶
func (*SQLiteCore) Identifier(s string) string
Identifier returns s quoted as a SQLite identifier. A "*" segment is left unquoted.