xsqlite

package
v0.0.0-...-2fa33bc Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DriverName = "sqlite"

DriverName is the default driver name for SQLite.

Variables

This section is empty.

Functions

func DefaultDSN

func DefaultDSN(dsn string) string

DefaultDSN preserves GORM's time.Time scan behavior with modernc and enables foreign keys on each new physical connection. Explicit DSN options take precedence. This can also be used when opening an external modernc pool.

func New

func New(config Config) gorm.Dialector

func Open

func Open(dsn string) gorm.Dialector

Types

type Config

type Config struct {
	DriverName string
	DSN        string
	Conn       gorm.ConnPool

	// ForeignKeysPerConnection is the caller's guarantee for an externally
	// configured pool or custom driver; xsqlite does not modify those pools.
	ForeignKeysPerConnection bool
}

type Dialector

type Dialector struct {
	DriverName string
	DSN        string
	Conn       gorm.ConnPool

	// ForeignKeysPerConnection declares that a supplied Conn or custom driver
	// enables foreign keys on every physical connection before use. The
	// built-in driver applies this by default, subject to explicit DSN options.
	ForeignKeysPerConnection bool
}

func (Dialector) BindVarTo

func (d Dialector) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v any)

func (Dialector) ClauseBuilders

func (d Dialector) ClauseBuilders() map[string]clause.ClauseBuilder

func (Dialector) ConfiguresForeignKeys

func (d Dialector) ConfiguresForeignKeys() bool

ConfiguresForeignKeys reports whether opening this dialector's pool applies the modernc defaults or the caller has explicitly opted into the external pool contract. The consumer must still check that foreign keys are enabled: modernc callers are allowed to override the default in the DSN.

func (Dialector) DataTypeOf

func (d Dialector) DataTypeOf(field *schema.Field) string

func (Dialector) DefaultValueOf

func (d Dialector) DefaultValueOf(field *schema.Field) clause.Expression

func (Dialector) Explain

func (d Dialector) Explain(sql string, vars ...any) string

func (Dialector) Initialize

func (d Dialector) Initialize(db *gorm.DB) (err error)

func (Dialector) Migrator

func (d Dialector) Migrator(db *gorm.DB) gorm.Migrator

func (Dialector) Name

func (d Dialector) Name() string

func (Dialector) QuoteTo

func (d Dialector) QuoteTo(writer clause.Writer, str string)

func (Dialector) RollbackTo

func (d Dialector) RollbackTo(tx *gorm.DB, name string) error

func (Dialector) SavePoint

func (d Dialector) SavePoint(tx *gorm.DB, name string) error

func (Dialector) Translate

func (d Dialector) Translate(err error) error

type Index

type Index struct {
	Name    string
	Origin  string
	Seq     int
	Unique  bool
	Partial bool
}

type JSON

type JSON jsontext.Value

JSON uses a JSON declaration and standard JSON values, never binary JSONB. Objects/arrays are stored as text. SQLite's NUMERIC affinity can coerce numeric scalars; use gorm:"type:JSON TEXT" when exact numeric text must be preserved. A zero value represents SQL NULL; JSON("null") represents JSON null. Use json_valid in a CHECK constraint if writes outside this type must also be validated: SQLite's JSON declaration alone does not enforce validity.

func (JSON) GormDBDataType

func (JSON) GormDBDataType(_ *gorm.DB, field *schema.Field) string

func (JSON) GormDataType

func (JSON) GormDataType() string

func (JSON) MarshalJSON

func (j JSON) MarshalJSON() ([]byte, error)

func (*JSON) Scan

func (j *JSON) Scan(value any) error

func (*JSON) UnmarshalJSON

func (j *JSON) UnmarshalJSON(data []byte) error

func (JSON) Value

func (j JSON) Value() (driver.Value, error)

type Migrator

type Migrator struct {
	migrator.Migrator
}

func (*Migrator) AlterColumn

func (m *Migrator) AlterColumn(value any, name string) error

func (*Migrator) BuildIndexOptions

func (m *Migrator) BuildIndexOptions(opts []schema.IndexOption, stmt *gorm.Statement) (results []any)

func (*Migrator) ColumnTypes

func (m *Migrator) ColumnTypes(value any) ([]gorm.ColumnType, error)

ColumnTypes returns metadata for the table’s columns.

func (*Migrator) CreateConstraint

func (m *Migrator) CreateConstraint(value any, name string) error

func (*Migrator) CreateIndex

func (m *Migrator) CreateIndex(value any, name string) error

func (*Migrator) CurrentDatabase

func (m *Migrator) CurrentDatabase() (name string)

func (*Migrator) DropColumn

func (m *Migrator) DropColumn(value any, name string) error

func (*Migrator) DropConstraint

func (m *Migrator) DropConstraint(value any, name string) error

func (*Migrator) DropIndex

func (m *Migrator) DropIndex(value any, name string) error

func (*Migrator) DropTable

func (m *Migrator) DropTable(values ...any) error

func (*Migrator) GetIndexes

func (m *Migrator) GetIndexes(value any) ([]gorm.Index, error)

GetIndexes return Indexes []gorm.Index and execErr error, See the doc

func (*Migrator) GetTables

func (m *Migrator) GetTables() (tableList []string, err error)

func (*Migrator) HasColumn

func (m *Migrator) HasColumn(value any, name string) bool

func (*Migrator) HasConstraint

func (m *Migrator) HasConstraint(value any, name string) bool

func (*Migrator) HasIndex

func (m *Migrator) HasIndex(value any, name string) bool

func (*Migrator) HasTable

func (m *Migrator) HasTable(value any) bool

func (*Migrator) RenameIndex

func (m *Migrator) RenameIndex(value any, oldName, newName string) error

func (*Migrator) RunWithoutForeignKey

func (m *Migrator) RunWithoutForeignKey(fc func() error) error

Jump to

Keyboard shortcuts

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