sqlite

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() dialects.Dialect

New returns a dialect that renders SQL for SQLite.

func UseSQLite

func UseSQLite()

UseSQLite registers the SQLite dialect under the "sqlite3" and "sqlite" driver names.

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 NewConfig

func NewConfig(path string) *Config

NewConfig returns a Config for the database file at path.

func (*Config) DataSourceName

func (c *Config) DataSourceName() string

DataSourceName returns the path to the SQLite database file.

func (*Config) DriverName

func (c *Config) DriverName() string

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.

Jump to

Keyboard shortcuts

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