Repository navigation
Writing Stores
github-actions[bot] edited this page Dec 2, 2026
·
5 revisions
Implement ablage.Store (see its documentation) and run the suite:
func TestMyStore(t *testing.T) {
storetest.Run(t, func(t *testing.T) ablage.Store { return mystore.New() })
}Building blocks in the root package:
-
Catalog: declared tables,Tables()in reference order,Referencing(table) -
Table.CheckInsert,CheckUpdate,CheckCond,CheckQuery: validate and convert values to their canonical types -
Cond.Match,Compare,Query.Less: the semantics every store must reproduce.Inlists can be very long (the suite uses 70,000 values);CheckCondhands them over sorted and without duplicates -
Row.Clone,CloneValue,NormalizeTime
Optional interfaces, which every store of this module implements and the suite tests when a store has them:
-
ablage.Aggregator(Aggregate): check withTable.CheckAggregation;Aggregation.Applydefines the result. Without it,ablage.AggregateandRepository.Aggregatefail withErrUnsupported. -
ablage.UniqueUpserter(UpsertOn):Upsertwith the conflict on a unique index.Table.CheckConflictfinds the index,Table.Conflictsdefines a conflict; the conflict on the index is checked before the id and other unique values. Without it,ablage.UpsertOnandRepository.UpsertOnfail withErrUnsupported.
A store that can commit a transaction atomically only up to a limit implements ablage.Limiter (MaxWrites) and fails beyond it with ErrTooLarge, writing nothing; never commit in parts. The suite checks it when a store has it; it must be at least 50 rows.
memstore is the reference implementation; cosmosstore shows a store without SQL.
Before 1.0, the Store interface may grow (e.g. for iterating or bulk writes); such changes are marked as breaking in the release notes.
ablage · Apache-2.0