sqlentry

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 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

Overview

Package sqlentry holds the shared PostgreSQL/SQLite bounded entry-listing logic. Stores should go through RunBoundedQuery and ApplyEpochFilter instead of copying the cursor, upToEntryId, fromSeq, and ordering predicates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyCreatedAtFilter added in v0.2.2

func ApplyCreatedAtFilter(base *gorm.DB, filter *registrystore.CreatedAtFilter, alias string) *gorm.DB

ApplyCreatedAtFilter appends timestamp predicates to base.

func ApplyEpochFilter

func ApplyEpochFilter(base *gorm.DB, epochFilter *registrystore.MemoryEpochFilter, latestWhenNil bool, latestErr string) (*gorm.DB, error)

func BoundedEntriesFromBase

func BoundedEntriesFromBase(ctx context.Context, base *gorm.DB, fromSeq *uint32, afterEntryID, beforeEntryID *string, tail bool, limit int, lookup LookupFunc, cursorEntryError CursorErrorFunc, entryIDValue EntryIDValueFunc, scanErr string) ([]model.Entry, *string, *string, error)

func EntryOrderSQL added in v0.4.0

func EntryOrderSQL(db *gorm.DB, alias string, descending bool) string

func EntryTimeOrderSQL added in v0.4.0

func EntryTimeOrderSQL(db *gorm.DB, alias string, descending bool) string

func FilterEntriesByCreatedAt added in v0.2.2

func FilterEntriesByCreatedAt(entries []model.Entry, filter *registrystore.CreatedAtFilter) []model.Entry

FilterEntriesByCreatedAt filters in-memory entries based on CreatedAtFilter.

func RunBoundedQuery

func RunBoundedQuery(ctx context.Context, query BoundedQuery) ([]model.Entry, *string, *string, error)

func UUIDStringValue

func UUIDStringValue(id uuid.UUID) any

func UUIDValue

func UUIDValue(id uuid.UUID) any

func WhereEntryOrderAtOrBeforeAlias

func WhereEntryOrderAtOrBeforeAlias(tx *gorm.DB, alias string, bound model.Entry, entryIDValue EntryIDValueFunc) *gorm.DB

func WhereEntryOrderBeforeAlias

func WhereEntryOrderBeforeAlias(tx *gorm.DB, alias string, bound model.Entry, entryIDValue EntryIDValueFunc) *gorm.DB

func WhereEntryOrderStrictlyAfterAlias

func WhereEntryOrderStrictlyAfterAlias(tx *gorm.DB, alias string, bound model.Entry, entryIDValue EntryIDValueFunc) *gorm.DB

func WhereEntryTimeAfterAlias added in v0.4.0

func WhereEntryTimeAfterAlias(tx *gorm.DB, alias string, bound time.Time, id any) *gorm.DB

func WhereSeqOrderBeforeAlias

func WhereSeqOrderBeforeAlias(tx *gorm.DB, alias string, bound model.Entry, entryIDValue EntryIDValueFunc) *gorm.DB

func WhereSeqOrderStrictlyAfterAlias

func WhereSeqOrderStrictlyAfterAlias(tx *gorm.DB, alias string, bound model.Entry, entryIDValue EntryIDValueFunc) *gorm.DB

Types

type BoundedQuery

type BoundedQuery struct {
	Base             *gorm.DB
	FromSeq          *uint32
	UpToEntryID      *string
	AfterEntryID     *string
	BeforeEntryID    *string
	Tail             bool
	Limit            int
	MaxLimit         int
	UpToLookup       LookupFunc
	BaseTransform    func(*gorm.DB) (*gorm.DB, error)
	CursorEntryError CursorErrorFunc
	LimitError       func(int) error
	EntryNotFound    func(string) error
	EntryIDValue     EntryIDValueFunc
	ScanErr          string
	CreatedAtFilter  *registrystore.CreatedAtFilter
}

type CursorErrorFunc

type CursorErrorFunc func(context.Context, string, string) error

type EntryIDValueFunc

type EntryIDValueFunc func(uuid.UUID) any

EntryIDValueFunc converts a UUID entry id into the value shape expected by a datastore/dialect. PostgreSQL compares UUID values directly, while SQLite stores entry ids as text.

type LookupFunc

type LookupFunc func(string) (model.Entry, bool, error)

Jump to

Keyboard shortcuts

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