Help us shape the future of Go! Take the 2026 Go Developer Survey

sqlite

package module
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 28 Imported by: 1

README

Sqlite

The Sqlite driver for facades.Orm() of Goravel.

Install

Run the command below in your project to install the package automatically:

./artisan package:install github.com/goravel/sqlite

Or check the setup file to install the package manually.

Testing

Run command below to run test:

go test ./...

Documentation

Index

Constants

View Source
const (
	Binding = "goravel.sqlite"
	Name    = "SQLite"
)

Variables

View Source
var (
	FailedToGenerateDSN = errors.New("failed to generate DSN, please check the database configuration")
	ConfigNotFound      = errors.New("not found database configuration")
)

Functions

func Open

func Open(dsn string) gorm.Dialector

Open opens a GORM dialector from a data source name.

func OpenDB

func OpenDB(db gorm.ConnPool) gorm.Dialector

Open opens a GORM dialector from a database handle.

Types

type Config

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

func NewConfig

func NewConfig(config config.Config, connection string) *Config

func (*Config) Config

func (r *Config) Config() config.Config

func (*Config) Connection

func (r *Config) Connection() string

func (*Config) Readers

func (r *Config) Readers() []contracts.FullConfig

func (*Config) Writers

func (r *Config) Writers() []contracts.FullConfig

type Dialector

type Dialector struct {
	DSN  string
	Conn gorm.ConnPool
}

func (Dialector) BindVarTo

func (dialector Dialector) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{})

func (Dialector) ClauseBuilders

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

func (Dialector) DataTypeOf

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

func (Dialector) DefaultValueOf

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

func (Dialector) Explain

func (dialector Dialector) Explain(sql string, vars ...interface{}) string

func (Dialector) Initialize

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

func (Dialector) Migrator

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

func (Dialector) Name

func (dialector Dialector) Name() string

func (Dialector) QuoteTo

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

func (Dialector) RollbackTo

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

func (Dialector) SavePoint

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

type Docker

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

func NewDocker

func NewDocker(database string) *Docker

func (*Docker) Build

func (r *Docker) Build() error

func (*Docker) Config

func (r *Docker) Config() docker.DatabaseConfig

func (*Docker) Database

func (r *Docker) Database(name string) (docker.DatabaseDriver, error)

func (*Docker) Driver

func (r *Docker) Driver() string

func (*Docker) Fresh

func (r *Docker) Fresh() error

func (*Docker) Image

func (r *Docker) Image(image docker.Image)

func (*Docker) Ready

func (r *Docker) Ready() error

func (*Docker) Reuse

func (r *Docker) Reuse(containerID string, port int) error

func (*Docker) Shutdown

func (r *Docker) Shutdown() error

type Grammar

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

func NewGrammar

func NewGrammar(log log.Log, prefix string) *Grammar

func (*Grammar) CompileAdd

func (r *Grammar) CompileAdd(blueprint driver.Blueprint, command *driver.Command) string

func (*Grammar) CompileChange

func (r *Grammar) CompileChange(blueprint driver.Blueprint, command *driver.Command) []string

func (*Grammar) CompileColumns

func (r *Grammar) CompileColumns(_, table string) (string, error)

func (*Grammar) CompileComment

func (r *Grammar) CompileComment(blueprint driver.Blueprint, command *driver.Command) string

func (*Grammar) CompileCreate

func (r *Grammar) CompileCreate(blueprint driver.Blueprint) string

func (*Grammar) CompileDefault

func (r *Grammar) CompileDefault(_ driver.Blueprint, _ *driver.Command) string

func (*Grammar) CompileDisableWriteableSchema

func (r *Grammar) CompileDisableWriteableSchema() string

func (*Grammar) CompileDrop

func (r *Grammar) CompileDrop(blueprint driver.Blueprint) string

func (*Grammar) CompileDropAllDomains

func (r *Grammar) CompileDropAllDomains(domains []string) string

func (*Grammar) CompileDropAllTables

func (r *Grammar) CompileDropAllTables(_ string, _ []driver.Table) []string

func (*Grammar) CompileDropAllTypes

func (r *Grammar) CompileDropAllTypes(_ string, _ []driver.Type) []string

func (*Grammar) CompileDropAllViews

func (r *Grammar) CompileDropAllViews(_ string, _ []driver.View) []string

func (*Grammar) CompileDropColumn

func (r *Grammar) CompileDropColumn(blueprint driver.Blueprint, command *driver.Command) []string

func (*Grammar) CompileDropForeign

func (r *Grammar) CompileDropForeign(_ driver.Blueprint, _ *driver.Command) string

func (*Grammar) CompileDropFullText

func (r *Grammar) CompileDropFullText(_ driver.Blueprint, _ *driver.Command) string

func (*Grammar) CompileDropIfExists

func (r *Grammar) CompileDropIfExists(blueprint driver.Blueprint) string

func (*Grammar) CompileDropIndex

func (r *Grammar) CompileDropIndex(_ driver.Blueprint, command *driver.Command) string

func (*Grammar) CompileDropPrimary

func (r *Grammar) CompileDropPrimary(_ driver.Blueprint, _ *driver.Command) string

func (*Grammar) CompileDropUnique

func (r *Grammar) CompileDropUnique(blueprint driver.Blueprint, command *driver.Command) string

func (*Grammar) CompileEnableWriteableSchema

func (r *Grammar) CompileEnableWriteableSchema() string

func (*Grammar) CompileForeign

func (r *Grammar) CompileForeign(_ driver.Blueprint, _ *driver.Command) string

func (*Grammar) CompileForeignKeys

func (r *Grammar) CompileForeignKeys(_, table string) string

func (*Grammar) CompileFullText

func (r *Grammar) CompileFullText(_ driver.Blueprint, _ *driver.Command) string

func (*Grammar) CompileInRandomOrder

func (r *Grammar) CompileInRandomOrder(builder sq.SelectBuilder, conditions *driver.Conditions) sq.SelectBuilder

func (*Grammar) CompileIndex

func (r *Grammar) CompileIndex(blueprint driver.Blueprint, command *driver.Command) string

func (*Grammar) CompileIndexes

func (r *Grammar) CompileIndexes(_, table string) (string, error)

func (*Grammar) CompileJsonColumnsUpdate

func (r *Grammar) CompileJsonColumnsUpdate(values map[string]any) (map[string]any, error)

func (*Grammar) CompileJsonContains

func (r *Grammar) CompileJsonContains(column string, value any, isNot bool) (string, []any, error)

func (*Grammar) CompileJsonContainsKey

func (r *Grammar) CompileJsonContainsKey(column string, isNot bool) string

func (*Grammar) CompileJsonLength

func (r *Grammar) CompileJsonLength(column string) string

func (*Grammar) CompileJsonSelector

func (r *Grammar) CompileJsonSelector(column string) string

func (*Grammar) CompileJsonValues

func (r *Grammar) CompileJsonValues(args ...any) []any

func (*Grammar) CompileLockForUpdate

func (r *Grammar) CompileLockForUpdate(builder sq.SelectBuilder, conditions *driver.Conditions) sq.SelectBuilder

func (*Grammar) CompileLockForUpdateForGorm

func (r *Grammar) CompileLockForUpdateForGorm() clause.Expression

func (*Grammar) CompilePlaceholderFormat

func (r *Grammar) CompilePlaceholderFormat() driver.PlaceholderFormat

func (*Grammar) CompilePrimary

func (r *Grammar) CompilePrimary(_ driver.Blueprint, _ *driver.Command) string

func (*Grammar) CompilePrune

func (r *Grammar) CompilePrune(_ string) string

func (*Grammar) CompileRandomOrderForGorm

func (r *Grammar) CompileRandomOrderForGorm() string

func (*Grammar) CompileRename

func (r *Grammar) CompileRename(blueprint driver.Blueprint, command *driver.Command) string

func (*Grammar) CompileRenameColumn

func (r *Grammar) CompileRenameColumn(blueprint driver.Blueprint, command *driver.Command, _ []driver.Column) (string, error)

func (*Grammar) CompileRenameIndex

func (r *Grammar) CompileRenameIndex(blueprint driver.Blueprint, command *driver.Command, indexes []driver.Index) []string

func (*Grammar) CompileSharedLock

func (r *Grammar) CompileSharedLock(builder sq.SelectBuilder, conditions *driver.Conditions) sq.SelectBuilder

func (*Grammar) CompileSharedLockForGorm

func (r *Grammar) CompileSharedLockForGorm() clause.Expression

func (*Grammar) CompileTableComment

func (r *Grammar) CompileTableComment(_ driver.Blueprint, _ *driver.Command) string

func (*Grammar) CompileTables

func (r *Grammar) CompileTables(database string) string

func (*Grammar) CompileTypes

func (r *Grammar) CompileTypes() string

func (*Grammar) CompileUnique

func (r *Grammar) CompileUnique(blueprint driver.Blueprint, command *driver.Command) string

func (*Grammar) CompileVersion

func (r *Grammar) CompileVersion() string

func (*Grammar) CompileViews

func (r *Grammar) CompileViews(database string) string

func (*Grammar) GetAttributeCommands

func (r *Grammar) GetAttributeCommands() []string

func (*Grammar) GetModifiers

func (r *Grammar) GetModifiers() []func(blueprint driver.Blueprint, column driver.ColumnDefinition) string

func (*Grammar) ModifyDefault

func (r *Grammar) ModifyDefault(blueprint driver.Blueprint, column driver.ColumnDefinition) string

func (*Grammar) ModifyIncrement

func (r *Grammar) ModifyIncrement(blueprint driver.Blueprint, column driver.ColumnDefinition) string

func (*Grammar) ModifyNullable

func (r *Grammar) ModifyNullable(blueprint driver.Blueprint, column driver.ColumnDefinition) string

func (*Grammar) TypeBigInteger

func (r *Grammar) TypeBigInteger(column driver.ColumnDefinition) string

func (*Grammar) TypeBoolean

func (r *Grammar) TypeBoolean(_ driver.ColumnDefinition) string

func (*Grammar) TypeChar

func (r *Grammar) TypeChar(column driver.ColumnDefinition) string

func (*Grammar) TypeDate

func (r *Grammar) TypeDate(column driver.ColumnDefinition) string

func (*Grammar) TypeDateTime

func (r *Grammar) TypeDateTime(column driver.ColumnDefinition) string

func (*Grammar) TypeDateTimeTz

func (r *Grammar) TypeDateTimeTz(column driver.ColumnDefinition) string

func (*Grammar) TypeDecimal

func (r *Grammar) TypeDecimal(column driver.ColumnDefinition) string

func (*Grammar) TypeDouble

func (r *Grammar) TypeDouble(column driver.ColumnDefinition) string

func (*Grammar) TypeEnum

func (r *Grammar) TypeEnum(column driver.ColumnDefinition) string

func (*Grammar) TypeFloat

func (r *Grammar) TypeFloat(column driver.ColumnDefinition) string

func (*Grammar) TypeInteger

func (r *Grammar) TypeInteger(column driver.ColumnDefinition) string

func (*Grammar) TypeJson

func (r *Grammar) TypeJson(column driver.ColumnDefinition) string

func (*Grammar) TypeJsonb

func (r *Grammar) TypeJsonb(column driver.ColumnDefinition) string

func (*Grammar) TypeLongText

func (r *Grammar) TypeLongText(column driver.ColumnDefinition) string

func (*Grammar) TypeMediumInteger

func (r *Grammar) TypeMediumInteger(column driver.ColumnDefinition) string

func (*Grammar) TypeMediumText

func (r *Grammar) TypeMediumText(column driver.ColumnDefinition) string

func (*Grammar) TypeSmallInteger

func (r *Grammar) TypeSmallInteger(column driver.ColumnDefinition) string

func (*Grammar) TypeString

func (r *Grammar) TypeString(column driver.ColumnDefinition) string

func (*Grammar) TypeText

func (r *Grammar) TypeText(column driver.ColumnDefinition) string

func (*Grammar) TypeTime

func (r *Grammar) TypeTime(column driver.ColumnDefinition) string

func (*Grammar) TypeTimeTz

func (r *Grammar) TypeTimeTz(column driver.ColumnDefinition) string

func (*Grammar) TypeTimestamp

func (r *Grammar) TypeTimestamp(column driver.ColumnDefinition) string

func (*Grammar) TypeTimestampTz

func (r *Grammar) TypeTimestampTz(column driver.ColumnDefinition) string

func (*Grammar) TypeTinyInteger

func (r *Grammar) TypeTinyInteger(column driver.ColumnDefinition) string

func (*Grammar) TypeTinyText

func (r *Grammar) TypeTinyText(column driver.ColumnDefinition) string

func (*Grammar) TypeUuid

func (r *Grammar) TypeUuid(column driver.ColumnDefinition) string

type Processor

type Processor struct {
}

func NewProcessor

func NewProcessor() *Processor

func (Processor) ProcessColumns

func (r Processor) ProcessColumns(dbColumns []driver.DBColumn) []driver.Column

func (Processor) ProcessForeignKeys

func (r Processor) ProcessForeignKeys(dbForeignKeys []driver.DBForeignKey) []driver.ForeignKey

func (Processor) ProcessIndexes

func (r Processor) ProcessIndexes(dbIndexes []driver.DBIndex) []driver.Index

func (Processor) ProcessTypes

func (r Processor) ProcessTypes(types []driver.Type) []driver.Type

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (r *ServiceProvider) Boot(app foundation.Application)

func (*ServiceProvider) Register

func (r *ServiceProvider) Register(app foundation.Application)

func (*ServiceProvider) Relationship

func (r *ServiceProvider) Relationship() binding.Relationship

type Sqlite

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

func NewSqlite

func NewSqlite(config config.Config, log log.Log, connection string) *Sqlite

func (*Sqlite) Docker

func (r *Sqlite) Docker() (docker.DatabaseDriver, error)

func (*Sqlite) Grammar

func (r *Sqlite) Grammar() driver.Grammar

func (*Sqlite) Pool

func (r *Sqlite) Pool() database.Pool

func (*Sqlite) Processor

func (r *Sqlite) Processor() driver.Processor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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