sqlite

package
v0.0.0-...-044a9da Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SqlDataType_Integer = iota + 1
	SqlDataType_Numeric
	SqlDataType_String
	SqlDataType_Blob
)

Variables

This section is empty.

Functions

func NewSqliteEntityStorage

func NewSqliteEntityStorage[T any, K storage.Key](
	getConnection func() *sqlx.DB, schema ITableSchema, ownerValue interface{}) (sto storage.IEntityStorage[T, K], err error)

func NewSqliteLinkStorage

func NewSqliteLinkStorage[T any, KS storage.Key, KO storage.Key](
	getConnection func() *sqlx.DB, schema ITableSchema,
	ownerValue interface{}) (sto storage.ILinkStorage[T, KS, KO], err error)

func NewSqliteRecordStorage

func NewSqliteRecordStorage[T any](
	getConnection func() *sqlx.DB, schema ITableSchema, ownerValue interface{}) (rto storage.IRecordStorage[T], err error)

func VerifyDatabase

func VerifyDatabase(connection *sqlx.DB, tables []ITableSchema, applyChanges bool) (result []string, err error)

Types

type IColumnSchema

type IColumnSchema interface {
	ColumnName() string
	ColumnSqlType() SqlDataType
}

type ISqliteStorage

type ISqliteStorage[T any] interface {
	SelectAll(func(T) bool) error
	SelectFilter([]string, [][]interface{}, func(T) bool) error
	Put([]T) error
	DeleteAll() error
	DeleteFilter([]string, [][]interface{}) error
}

type ITableSchema

type ITableSchema interface {
	TableName() string
	SetTableName(string)
	OwnerColumn() IColumnSchema
	Columns() []IColumnSchema
	PrimaryKey() []string
	Indexes() map[string][]string
	NewEntity() interface{}
	GetColumnByName(string) IColumnSchema
}

func LoadTableSchema

func LoadTableSchema(entityType reflect.Type, primaryKey []string, indexes map[string][]string,
	ownerColumn string, ownerType SqlDataType) (schema ITableSchema, err error)

type SqlDataType

type SqlDataType uint32

func (SqlDataType) ToSqlType

func (sdt SqlDataType) ToSqlType() string

Jump to

Keyboard shortcuts

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