sqlstore

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sqlstore persists one document per timeline using an application-owned database/sql pool. It uses ? bind parameters and does not manage schema or GC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store uses timelines(id, payload, version, created_at, updated_at). id is the primary key; version is incremented on every accepted change. JSON merging is done in Go, so backends need no vendor-specific JSON update expressions.

func New

func New(db *sql.DB) *Store

func (*Store) Latest added in v0.3.0

func (s *Store) Latest(ctx context.Context, after time.Time, limit int) ([]store.Document, error)

func (*Store) MGet added in v0.3.0

func (s *Store) MGet(ctx context.Context, ids []string) ([]store.Document, error)

func (*Store) Merge

func (s *Store) Merge(ctx context.Context, id string, update store.Update) error

Merge retries only confirmed version races. An ambiguous commit returns an error; retrying the same update is safe even if the first commit succeeded.

func (*Store) Read

func (s *Store) Read(ctx context.Context, id string) (store.Document, error)

Jump to

Keyboard shortcuts

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