sqlite

package module
v0.0.0-...-6442de4 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFilterPath = errors.New("invalid filter path")

ErrInvalidFilterPath is returned when a Filter.Path or OrderSpec.Path contains characters that could break out of a JSON-path literal in a json_extract expression. Sentinel for callers that want to distinguish input validation errors from storage errors.

View Source
var ErrScanBudgetExhausted = errors.New("scan budget exhausted")

ErrScanBudgetExhausted is returned when a search with a residual filter examines more rows than the configured SearchScanLimit without filling the requested result page. Callers should tighten their filter.

Functions

func DefaultDBPath

func DefaultDBPath() string

DefaultDBPath returns the per-OS default path for the sqlite database file. Linux and macOS share XDG semantics ($XDG_DATA_HOME/cyoda/cyoda.db, fallback ~/.local/share/cyoda/cyoda.db). Windows uses %LocalAppData%\cyoda\ cyoda.db. Returns the literal "cyoda.db" (current directory) when the user home directory cannot be determined.

Types

type Clock

type Clock interface {
	Now() time.Time
}

Clock abstracts time.Now so tests can advance it deterministically. Production uses wallClock; conformance tests use TestClock.

type Option

type Option func(*StoreFactory)

Option is a functional option for newStoreFactory.

func WithClock

func WithClock(c Clock) Option

WithClock injects a custom Clock into the factory. Used by conformance tests to advance time deterministically.

type StoreFactory

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

StoreFactory implements spi.StoreFactory backed by SQLite.

func NewStoreFactoryForTest

func NewStoreFactoryForTest(ctx context.Context, dbPath string, opts ...Option) (*StoreFactory, error)

NewStoreFactoryForTest creates a factory with auto-migrate enabled and the given path. Intended for test use only.

func NewStoreFactoryForTestWithScanLimit

func NewStoreFactoryForTestWithScanLimit(ctx context.Context, dbPath string, scanLimit int, opts ...Option) (*StoreFactory, error)

NewStoreFactoryForTestWithScanLimit creates a factory with a custom scan limit for testing scan budget exhaustion. Intended for test use only.

func (*StoreFactory) AsyncSearchStore

func (f *StoreFactory) AsyncSearchStore(_ context.Context) (spi.AsyncSearchStore, error)

func (*StoreFactory) Close

func (f *StoreFactory) Close() error

func (*StoreFactory) EntityStore

func (f *StoreFactory) EntityStore(ctx context.Context) (spi.EntityStore, error)

func (*StoreFactory) KeyValueStore

func (f *StoreFactory) KeyValueStore(ctx context.Context) (spi.KeyValueStore, error)

func (*StoreFactory) MessageStore

func (f *StoreFactory) MessageStore(ctx context.Context) (spi.MessageStore, error)

func (*StoreFactory) ModelStore

func (f *StoreFactory) ModelStore(ctx context.Context) (spi.ModelStore, error)

func (*StoreFactory) StateMachineAuditStore

func (f *StoreFactory) StateMachineAuditStore(ctx context.Context) (spi.StateMachineAuditStore, error)

func (*StoreFactory) TransactionManager

func (f *StoreFactory) TransactionManager(_ context.Context) (spi.TransactionManager, error)

TransactionManager implements spi.StoreFactory. Returns the TM registered via initTransactionManager. Errors if none is set.

func (*StoreFactory) WorkflowStore

func (f *StoreFactory) WorkflowStore(ctx context.Context) (spi.WorkflowStore, error)

type TestClock

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

TestClock is a mutable clock for tests. Advance(d) moves it forward; Now returns the current virtual time. Safe for concurrent use.

func NewTestClock

func NewTestClock() *TestClock

NewTestClock returns a TestClock starting at the current wall-clock time.

func (*TestClock) Advance

func (c *TestClock) Advance(d time.Duration)

Advance moves the virtual clock forward by d. d must be > 0; d <= 0 panics. Matches the spitest.Harness.AdvanceClock contract.

func (*TestClock) Now

func (c *TestClock) Now() time.Time

Now returns the current virtual time.

Jump to

Keyboard shortcuts

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