sqlite

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeSqliteDatabase added in v0.2.7

InitializeSqliteDatabase opens per-boundary SQLite pools and constructs the five backend interfaces. Boundary identity is the file: {dir}/{boundary}.db.

Types

type BoundaryPools added in v0.2.7

type BoundaryPools struct {
	Boundary string
	Write    *sqlitex.Pool
	Read     *sqlitex.Pool
}

BoundaryPools holds the write and read connection pools backing one boundary's SQLite file.

Write pool is sized to 1: SQLite serializes writers anyway via its file lock, so a single in-flight writer queues callers in Go and avoids SQLITE_BUSY churn. Read pool is sized to runtime.NumCPU() — under WAL, readers run concurrently with the single writer.

func OpenBoundaryPools added in v0.2.7

func OpenBoundaryPools(ctx context.Context, dir, boundary, adminBoundary string) (*BoundaryPools, error)

OpenBoundaryPools opens write+read pools for one boundary at {dir}/{boundary}.db. Migrations are applied on the first connection drawn from the write pool. adminBoundary controls whether admin-only tables (users, users_count) are created.

func (*BoundaryPools) Close added in v0.2.7

func (b *BoundaryPools) Close() error

type SqliteAdminDB added in v0.2.7

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

func NewSqliteAdminDB added in v0.2.7

func NewSqliteAdminDB(pools map[string]*BoundaryPools, adminBoundary string, logger logging.Logger) *SqliteAdminDB

func (*SqliteAdminDB) CreateBoundaryIndex added in v0.2.7

func (a *SqliteAdminDB) CreateBoundaryIndex(
	ctx context.Context,
	boundary, name string,
	fields []common.IndexField,
	conditions []common.IndexCondition,
	combinator string,
) error

CreateBoundaryIndex builds a partial expression index over orisun_es_event.data JSON keys. Index name = "{name}_idx" inside the boundary's database.

func (*SqliteAdminDB) DeleteUser added in v0.2.7

func (a *SqliteAdminDB) DeleteUser(id string) error

func (*SqliteAdminDB) DropBoundaryIndex added in v0.2.7

func (a *SqliteAdminDB) DropBoundaryIndex(ctx context.Context, boundary, name string) error

func (*SqliteAdminDB) GetEventsCount added in v0.2.7

func (a *SqliteAdminDB) GetEventsCount(boundary string) (int, error)

func (*SqliteAdminDB) GetProjectorLastPosition added in v0.2.7

func (a *SqliteAdminDB) GetProjectorLastPosition(projectorName string) (*eventstore.Position, error)

func (*SqliteAdminDB) GetUserById added in v0.2.7

func (a *SqliteAdminDB) GetUserById(id string) (eventstore.User, error)

func (*SqliteAdminDB) GetUserByUsername added in v0.2.7

func (a *SqliteAdminDB) GetUserByUsername(username string) (eventstore.User, error)

func (*SqliteAdminDB) GetUsersCount added in v0.2.7

func (a *SqliteAdminDB) GetUsersCount() (uint32, error)

func (*SqliteAdminDB) ListAdminUsers added in v0.2.7

func (a *SqliteAdminDB) ListAdminUsers() ([]*eventstore.User, error)

func (*SqliteAdminDB) SaveEventCount added in v0.2.7

func (a *SqliteAdminDB) SaveEventCount(count int, boundary string) error

func (*SqliteAdminDB) SaveUsersCount added in v0.2.7

func (a *SqliteAdminDB) SaveUsersCount(count uint32) error

func (*SqliteAdminDB) UpdateProjectorPosition added in v0.2.7

func (a *SqliteAdminDB) UpdateProjectorPosition(name string, position *eventstore.Position) error

func (*SqliteAdminDB) UpsertUser added in v0.2.7

func (a *SqliteAdminDB) UpsertUser(user eventstore.User) error

type SqliteEventPublishing added in v0.2.7

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

func NewSqliteEventPublishing added in v0.2.7

func NewSqliteEventPublishing(pools map[string]*BoundaryPools, logger logging.Logger) *SqliteEventPublishing

func (*SqliteEventPublishing) GetLastPublishedEventPosition added in v0.2.7

func (p *SqliteEventPublishing) GetLastPublishedEventPosition(ctx context.Context, boundary string) (eventstore.Position, error)

func (*SqliteEventPublishing) InsertLastPublishedEvent added in v0.2.7

func (p *SqliteEventPublishing) InsertLastPublishedEvent(ctx context.Context, boundary string, transactionID, globalID int64) error

type SqliteGetEvents added in v0.2.7

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

func NewSqliteGetEvents added in v0.2.7

func NewSqliteGetEvents(pools map[string]*BoundaryPools, logger logging.Logger) *SqliteGetEvents

func (*SqliteGetEvents) Get added in v0.2.7

type SqliteSaveEvents added in v0.2.7

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

func NewSqliteSaveEvents added in v0.2.7

func NewSqliteSaveEvents(pools map[string]*BoundaryPools, logger logging.Logger) *SqliteSaveEvents

func (*SqliteSaveEvents) Save added in v0.2.7

func (s *SqliteSaveEvents) Save(
	ctx context.Context,
	events []eventstore.EventWithMapTags,
	boundary string,
	expectedPosition *eventstore.Position,
	streamConsistencyCondition *eventstore.Query,
) (transactionID string, globalID int64, err error)

Jump to

Keyboard shortcuts

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