Documentation
¶
Overview ¶
Package fabriqtest is fabriq's exported test kit.
Package fabriqtest is fabriq's exported test kit: in-memory fakes for every port, a combined World wiring them over shared memory, and (in later phases) the testcontainers harness and seeded fixtures.
Downstream services unit-test against these fakes; the same behavioral contracts are enforced on real adapters by the integration suites.
Index ¶
- Constants
- Variables
- func ApplyDDL(t testing.TB, dsn string, stmts []string)
- func CreateAppRole(t testing.TB, superDSN string) string
- func NewConformanceBackend(t testing.TB) conformance.Backend
- func NewFabric(w *World) query.Fabric
- func QueryStrings(t testing.TB, dsn, sql string, args ...any) []string
- func RunCacheConformance(t *testing.T, newCache func(t *testing.T) cache.Cache)
- func StartClickHouse(t testing.TB) string
- func StartElasticsearch(t testing.TB) string
- func StartFalkorDB(t testing.TB) string
- func StartPostgres(t testing.TB) string
- func StartRedis(t testing.TB) string
- type FakeAnalytics
- func (f *FakeAnalytics) Query(ctx context.Context, q query.AnalyticsQuery, into any) error
- func (f *FakeAnalytics) QueryRaw(ctx context.Context, _ any, _ string, _ ...any) error
- func (f *FakeAnalytics) Track(ctx context.Context, events []query.AnalyticsEvent) error
- func (f *FakeAnalytics) UpsertInsightFacts(ctx context.Context, facts []insights.Fact) error
- type FakeAnalyticsSink
- func (s *FakeAnalyticsSink) AllWatermarks(_ context.Context, tenantID string) ([]analytics.Watermark, error)
- func (s *FakeAnalyticsSink) AppendEvents(_ context.Context, events []analytics.Event) error
- func (s *FakeAnalyticsSink) Close() error
- func (s *FakeAnalyticsSink) Events() map[string]analytics.Event
- func (s *FakeAnalyticsSink) Facts() map[string]analytics.Fact
- func (s *FakeAnalyticsSink) LagByTenant(_ context.Context) (map[string]float64, error)
- func (s *FakeAnalyticsSink) MaintainPartitions(_ context.Context, _ time.Duration) (created, dropped int, err error)
- func (s *FakeAnalyticsSink) PruneEvents(_ context.Context, olderThan time.Time) (int64, error)
- func (s *FakeAnalyticsSink) PurgeTenant(_ context.Context, tenantID string) (int64, error)
- func (s *FakeAnalyticsSink) ReprojectTenant(_ context.Context, tenantID, aggregate string, ...) (int64, error)
- func (s *FakeAnalyticsSink) SetWatermark(_ context.Context, ws []analytics.Watermark) error
- func (s *FakeAnalyticsSink) UpsertFacts(_ context.Context, facts []analytics.Fact) error
- func (s *FakeAnalyticsSink) Watermark(_ context.Context, tenant, agg, id string) (int64, error)
- type FakeBlob
- func (f *FakeBlob) Capabilities() blob.Caps
- func (f *FakeBlob) Copy(ctx context.Context, srcKey, dstKey string) (blob.ObjectInfo, error)
- func (f *FakeBlob) Delete(ctx context.Context, key string) error
- func (f *FakeBlob) Get(ctx context.Context, key string) (io.ReadCloser, blob.ObjectInfo, error)
- func (f *FakeBlob) Head(ctx context.Context, key string) (blob.ObjectInfo, error)
- func (f *FakeBlob) List(ctx context.Context, prefix string) ([]blob.ObjectInfo, error)
- func (f *FakeBlob) Put(ctx context.Context, key string, r io.Reader, o blob.PutOpts) (blob.ObjectInfo, error)
- type FakeCAS
- type FakeCache
- func (c *FakeCache) Close() error
- func (c *FakeCache) Get(ctx context.Context, ks cache.Keyspace, key string) (val []byte, ok bool, err error)
- func (c *FakeCache) GetOrLoad(ctx context.Context, ks cache.Keyspace, key string, ...) ([]byte, error)
- func (c *FakeCache) Invalidate(ctx context.Context, ks cache.Keyspace, keys ...string) error
- func (c *FakeCache) InvalidateEntity(ctx context.Context, entity string) error
- func (c *FakeCache) InvalidateKeyspace(ctx context.Context, ks cache.Keyspace) error
- func (c *FakeCache) Set(ctx context.Context, ks cache.Keyspace, key string, val []byte) error
- type FakeCatalog
- type FakeDocumentStore
- func (f *FakeDocumentStore) ApplyUpdate(_ context.Context, docID string, update []byte) error
- func (f *FakeDocumentStore) Compact(_ context.Context, docID string) error
- func (f *FakeDocumentStore) DeleteHistory(_ context.Context, docID string) error
- func (f *FakeDocumentStore) DeletedHistory(docID string) bool
- func (f *FakeDocumentStore) ListSegments(_ context.Context, docID string) ([]document.SegmentInfo, error)
- func (f *FakeDocumentStore) ReadHistory(_ context.Context, docID string, seqLo, seqHi int64) ([]document.HistoryUpdate, error)
- func (f *FakeDocumentStore) SeedHistory(docID string, ups []document.HistoryUpdate)
- func (f *FakeDocumentStore) SeedSegments(docID string, segs []document.SegmentInfo)
- func (f *FakeDocumentStore) Snapshot(_ context.Context, docID string) (document.Materialized, error)
- func (f *FakeDocumentStore) Sync(_ context.Context, docID string, stateVector []byte) ([]byte, error)
- type FakeGraph
- func (g *FakeGraph) ApplyMutations(ctx context.Context, target string, muts []projection.Mutation) error
- func (g *FakeGraph) Cann(cypher string, ids []string)
- func (g *FakeGraph) HasEdge(target, rel, fromLabel, fromID, toLabel, toID string) bool
- func (g *FakeGraph) Node(target, label, id string) (FakeNode, bool)
- func (g *FakeGraph) Query(_ context.Context, cypher string, _ map[string]any, into any) error
- func (g *FakeGraph) TraverseAndHydrate(ctx context.Context, cypher string, params map[string]any, into any) error
- type FakeNode
- type FakeProjectionState
- type FakeRelational
- func (r *FakeRelational) Get(ctx context.Context, entity, id string, into any) error
- func (r *FakeRelational) GetMany(ctx context.Context, entity string, ids []string, into any) error
- func (r *FakeRelational) List(ctx context.Context, entity string, q query.ListQuery, into any) error
- func (r *FakeRelational) Query(context.Context, any, string, ...any) error
- type FakeSearch
- type FakeSpatial
- func (f *FakeSpatial) Delete(ctx context.Context, entity, id string) error
- func (f *FakeSpatial) Get(ctx context.Context, entity, id string) (geom query.Geometry, meta map[string]any, ok bool, err error)
- func (f *FakeSpatial) Upsert(ctx context.Context, entity, id string, geom query.Geometry, ...) error
- func (f *FakeSpatial) Within(ctx context.Context, q query.SpatialQuery, into any) error
- type FakeStore
- type FakeTS
- type FakeVector
- func (f *FakeVector) Delete(ctx context.Context, entity, id string) error
- func (f *FakeVector) DeleteByMeta(ctx context.Context, entity string, filter map[string]string) error
- func (f *FakeVector) Get(ctx context.Context, entity, id string) ([]float32, error)
- func (f *FakeVector) Similar(ctx context.Context, q query.VectorQuery, into any) error
- func (f *FakeVector) Upsert(ctx context.Context, entity, id string, embedding []float32, ...) error
- type World
Constants ¶
const ( PostgresImage = "timescale/timescaledb-ha:pg16-all" // PostgresPlainImage is the vanilla upstream Postgres image used for the // primary+standby replication harness (StartPrimaryStandby). It backs the // catalog control database — a single plain table with no pgvector/timescale // needs — and, unlike timescaledb-ha, has no HA entrypoint that fights // pg_basebackup-based standby setup. PostgresPlainImage = "postgres:16-alpine" RedisImage = "redis:7-alpine" FalkorDBImage = "falkordb/falkordb:v4.2.2" // pinned: multi-label + SET n:Label ElasticsearchImage = "elasticsearch:9.4.1" // ClickHouseImage pins a server new enough that lightweight DELETE is GA and // enabled by default (>= 23.3). ClickHouseImage = "clickhouse/clickhouse-server:24.3" )
Container images for the integration harness. timescaledb-ha bundles TimescaleDB and pgvector, matching the production datastore contract.
Variables ¶
var ErrFakeNotFound = fabriqerr.ErrNotFound
ErrFakeNotFound is the not-found error returned by fakes; it is the canonical fabriq ErrNotFound so errors.Is works either way.
Functions ¶
func ApplyDDL ¶ added in v0.0.3
ApplyDDL executes the given statements against dsn as the connecting role (typically the superuser/owner DSN). It is the seam tests use to create application-defined materialization targets (e.g. domain.PagesDDL()) that are no longer part of fabriq's shipped migration chain. Apply it BEFORE CreateAppRole so the app role inherits grants on the new tables.
func CreateAppRole ¶
CreateAppRole provisions a NON-superuser application role on a database previously started with StartPostgres and returns a DSN for it.
This mirrors production: migrations run as the schema owner; the application connects as a restricted role so RLS actually applies (Postgres row security NEVER constrains superusers). Call it AFTER running migrations.
func NewConformanceBackend ¶
func NewConformanceBackend(t testing.TB) conformance.Backend
NewConformanceBackend builds a fake-backed conformance.Backend over the domain registry. It is the fast (Docker-free) gate that keeps the fakes from drifting from real-adapter behavior.
func NewFabric ¶
NewFabric returns a query.Fabric backed by the World's in-memory fakes. Exec runs through a command.Executor on the World's store (so writes are visible through Relational). Subscribe returns a fresh buffered channel (no deltas are published unless a test drives the underlying fakes); WaitForProjection is a no-op.
func QueryStrings ¶ added in v0.0.6
QueryStrings runs a single-column query against dsn and returns the rows as strings — the seam integration tests use for schema-shape assertions (information_schema / pg_catalog checks).
func RunCacheConformance ¶
RunCacheConformance is the single behavioral contract for cache.Cache. It is run against FakeCache (unit) and the grove-kv adapter (integration) so the two can never drift. newCache returns a fresh, empty cache per subtest.
func StartClickHouse ¶ added in v0.0.6
StartClickHouse launches a ClickHouse container and returns its clickhouse:// DSN. The container terminates with the test.
func StartElasticsearch ¶
StartElasticsearch launches a single-node Elasticsearch container (security off, HTTP only) and returns its base URL. The container terminates with the test.
func StartFalkorDB ¶
StartFalkorDB launches a FalkorDB container and returns its address (host:port). The container terminates with the test.
func StartPostgres ¶
StartPostgres launches a Postgres+Timescale+pgvector container and returns its DSN. The container terminates with the test.
func StartRedis ¶
StartRedis launches a Redis container and returns its address (host:port). The container terminates with the test.
Types ¶
type FakeAnalytics ¶ added in v0.0.6
type FakeAnalytics struct {
// contains filtered or unexported fields
}
FakeAnalytics is an in-memory query.AnalyticsQuerier for tests. Events are keyed tenant-first so cross-tenant reads are structurally impossible.
func NewFakeAnalytics ¶ added in v0.0.6
func NewFakeAnalytics(reg *registry.Registry) *FakeAnalytics
NewFakeAnalytics returns an empty FakeAnalytics that resolves Query.Source against reg via insights.ResolveSource — the same resolver the real Postgres adapter uses, so routing (metric > entity > event) can't drift between the fake and the adapter. reg may be nil, in which case every source resolves to an event descriptor (the prior back-compat behavior).
func (*FakeAnalytics) Query ¶ added in v0.0.6
func (f *FakeAnalytics) Query(ctx context.Context, q query.AnalyticsQuery, into any) error
Query implements query.AnalyticsQuerier by aggregating in-memory: filter by Source/time-window/Filter, group by (Dimensions..., time bucket), fold Measures, order deterministically, and apply Limit. Output rows are marshaled into `into` (a *[]map[string]any) via a JSON round-trip.
func (*FakeAnalytics) QueryRaw ¶ added in v0.0.6
QueryRaw implements query.AnalyticsQuerier. Raw SQL has no in-memory analogue; the fake always errors. The conformance suite does not exercise this method — only the real adapter does.
func (*FakeAnalytics) Track ¶ added in v0.0.6
func (f *FakeAnalytics) Track(ctx context.Context, events []query.AnalyticsEvent) error
Track implements query.AnalyticsQuerier. Events sharing a non-empty DedupKey (scoped per tenant) after the first Track call are dropped.
func (*FakeAnalytics) UpsertInsightFacts ¶ added in v0.0.6
UpsertInsightFacts implements insights.FactSink: an in-memory, version- gated upsert keyed tenant|entity|aggID, mirroring the real adapter's (tenant_id, entity, agg_id) uniqueness + "WHERE EXCLUDED.version > fabriq_insights_facts.version" gate (adapters/postgres/insights.go's UpsertInsightFacts) — an equal-or-older version is a silent no-op, never an error, so redelivery from the proj:insights consumer stays idempotent.
type FakeAnalyticsSink ¶ added in v0.0.6
type FakeAnalyticsSink struct {
// contains filtered or unexported fields
}
FakeAnalyticsSink is an in-memory analytics.Sink with the same idempotency semantics as the Postgres adapter. It is the conformance twin used to unit-test the applier, consumer, and backfill without Docker.
func NewFakeAnalyticsSink ¶ added in v0.0.6
func NewFakeAnalyticsSink() *FakeAnalyticsSink
func (*FakeAnalyticsSink) AllWatermarks ¶ added in v0.0.6
func (s *FakeAnalyticsSink) AllWatermarks(_ context.Context, tenantID string) ([]analytics.Watermark, error)
AllWatermarks returns every applied watermark for a tenant.
func (*FakeAnalyticsSink) AppendEvents ¶ added in v0.0.6
func (*FakeAnalyticsSink) Close ¶ added in v0.0.6
func (s *FakeAnalyticsSink) Close() error
func (*FakeAnalyticsSink) Events ¶ added in v0.0.6
func (s *FakeAnalyticsSink) Events() map[string]analytics.Event
Events returns a snapshot of all appended events (test inspection).
func (*FakeAnalyticsSink) Facts ¶ added in v0.0.6
func (s *FakeAnalyticsSink) Facts() map[string]analytics.Fact
Facts returns a snapshot keyed by tenant|aggregate|aggID (test inspection).
func (*FakeAnalyticsSink) LagByTenant ¶ added in v0.0.6
LagByTenant returns now() - (that tenant's newest fact At) per tenant.
func (*FakeAnalyticsSink) MaintainPartitions ¶ added in v0.0.6
func (s *FakeAnalyticsSink) MaintainPartitions(_ context.Context, _ time.Duration) (created, dropped int, err error)
MaintainPartitions is a no-op for the in-memory fake (it does not partition).
func (*FakeAnalyticsSink) PruneEvents ¶ added in v0.0.6
PruneEvents deletes history events older than olderThan across all tenants.
func (*FakeAnalyticsSink) PurgeTenant ¶ added in v0.0.6
PurgeTenant hard-deletes every fact, event, and watermark for one tenant and returns the count removed. Idempotent.
func (*FakeAnalyticsSink) ReprojectTenant ¶ added in v0.0.6
func (s *FakeAnalyticsSink) ReprojectTenant(_ context.Context, tenantID, aggregate string, transform func(json.RawMessage) (json.RawMessage, error)) (int64, error)
ReprojectTenant re-projects stored fact and event payloads for a tenant (and optional aggregate) through transform, in place, returning the count changed.
func (*FakeAnalyticsSink) SetWatermark ¶ added in v0.0.6
func (*FakeAnalyticsSink) UpsertFacts ¶ added in v0.0.6
type FakeBlob ¶
type FakeBlob struct {
// contains filtered or unexported fields
}
FakeBlob is an in-memory, tenant-scoped blob.Store for tests. It implements only the core Store surface — no capability sub-interfaces — so Caps reports all false and capability-gated conformance cases skip.
func (*FakeBlob) Capabilities ¶
func (*FakeBlob) Get ¶
func (f *FakeBlob) Get(ctx context.Context, key string) (io.ReadCloser, blob.ObjectInfo, error)
type FakeCAS ¶
type FakeCAS struct {
// contains filtered or unexported fields
}
FakeCAS is an in-memory content-addressed store for hermetic tests. It implements blob.CAS, dedups by sha256, and is tenant-agnostic.
type FakeCache ¶
type FakeCache struct {
// contains filtered or unexported fields
}
FakeCache is an in-memory cache.Cache for unit tests. It implements the same behavioral contract (RunCacheConformance) as the real grove-kv adapter: scope isolation, generation invalidation, single-flight GetOrLoad, TTL.
func (*FakeCache) Invalidate ¶
func (*FakeCache) InvalidateEntity ¶
InvalidateEntity bumps the entity generation for Global + Tenant + (if present) TenantScope partitions, mirroring the adapter.
func (*FakeCache) InvalidateKeyspace ¶
type FakeCatalog ¶ added in v0.0.6
type FakeCatalog struct {
// contains filtered or unexported fields
}
FakeCatalog is the in-memory tenant catalog (catalog.Catalog): the deterministic control plane the db-per-tenant router, provisioner and sweeper are unit-tested against. Semantics are pinned by the shared contract suite (core/catalog/catalogtest), which the Postgres control store must also pass.
func NewFakeCatalog ¶ added in v0.0.6
func NewFakeCatalog() *FakeCatalog
NewFakeCatalog returns an empty catalog.
type FakeDocumentStore ¶
type FakeDocumentStore struct {
// contains filtered or unexported fields
}
FakeDocumentStore is a real in-memory document plane: an append-only per-doc update log with monotonic seqs, seq-vector Sync (snapshot + tail, mirroring the postgres wire shape), grove-engine folds via crdt.ApplyChange, and log-into-snapshot compaction — the contract suite in core/document runs against it.
It additionally implements the optional history-offload capabilities (document.SegmentLister, document.HistoryReader, document.HistoryPurger) against in-memory seeded state, so adminapi handlers that type-assert for those capabilities can be unit-tested without a real offload-backed store. Tests seed state via SeedSegments/SeedHistory and observe purges via DeletedHistory.
func (*FakeDocumentStore) ApplyUpdate ¶
ApplyUpdate implements document.Store: append one encoded update (a non-empty JSON []crdt.ChangeRecord) to the doc's log.
func (*FakeDocumentStore) Compact ¶
func (f *FakeDocumentStore) Compact(_ context.Context, docID string) error
Compact implements document.Store: fold the log into the snapshot and trim it (storage-only; Sync output is unchanged).
func (*FakeDocumentStore) DeleteHistory ¶ added in v0.0.4
func (f *FakeDocumentStore) DeleteHistory(_ context.Context, docID string) error
DeleteHistory implements document.HistoryPurger: it clears docID's seeded segments and history and records the purge for DeletedHistory to observe.
func (*FakeDocumentStore) DeletedHistory ¶ added in v0.0.4
func (f *FakeDocumentStore) DeletedHistory(docID string) bool
DeletedHistory reports whether DeleteHistory has been called for docID.
func (*FakeDocumentStore) ListSegments ¶ added in v0.0.4
func (f *FakeDocumentStore) ListSegments(_ context.Context, docID string) ([]document.SegmentInfo, error)
ListSegments implements document.SegmentLister over seeded state.
func (*FakeDocumentStore) ReadHistory ¶ added in v0.0.4
func (f *FakeDocumentStore) ReadHistory(_ context.Context, docID string, seqLo, seqHi int64) ([]document.HistoryUpdate, error)
ReadHistory implements document.HistoryReader over seeded state, filtering to updates with seqLo <= seq <= seqHi and returning them in seq order.
func (*FakeDocumentStore) SeedHistory ¶ added in v0.0.4
func (f *FakeDocumentStore) SeedHistory(docID string, ups []document.HistoryUpdate)
SeedHistory seeds the raw update history ReadHistory filters over for docID, replacing any previously seeded history for that doc.
func (*FakeDocumentStore) SeedSegments ¶ added in v0.0.4
func (f *FakeDocumentStore) SeedSegments(docID string, segs []document.SegmentInfo)
SeedSegments seeds the sealed-segment metadata ListSegments returns for docID, replacing any previously seeded segments for that doc.
func (*FakeDocumentStore) Snapshot ¶
func (f *FakeDocumentStore) Snapshot(_ context.Context, docID string) (document.Materialized, error)
Snapshot implements document.Store: merged state projected onto column-keyed values.
func (*FakeDocumentStore) Sync ¶
func (f *FakeDocumentStore) Sync(_ context.Context, docID string, stateVector []byte) ([]byte, error)
Sync implements document.Store: 8-byte big-endian last-seen seq in, JSON {seq, snapshot?, updates[]} out (snapshot when the client is behind the compaction floor) — the postgres adapter's wire shape.
type FakeGraph ¶
type FakeGraph struct {
// contains filtered or unexported fields
}
FakeGraph applies engine-neutral mutations to an in-memory property graph with the same version gating real adapters implement, and serves canned responses for raw Cypher (fakes do not parse Cypher).
func NewFakeGraph ¶
func NewFakeGraph(reg *registry.Registry, rel query.RelationalQuerier) *FakeGraph
NewFakeGraph builds a graph fake hydrating through rel.
func (*FakeGraph) ApplyMutations ¶
func (g *FakeGraph) ApplyMutations(ctx context.Context, target string, muts []projection.Mutation) error
ApplyMutations implements the projection write path with version gating. target "" resolves to the tenant's live graph (tenant from ctx), the same contract real sinks implement.
type FakeProjectionState ¶
type FakeProjectionState struct {
// contains filtered or unexported fields
}
FakeProjectionState tracks applied versions per aggregate for WaitForProjection tests; projection consumers (or tests) advance it with SetApplied.
func (*FakeProjectionState) AppliedVersion ¶
func (f *FakeProjectionState) AppliedVersion(_ context.Context, tenantID, proj, aggregate, aggID string) (int64, error)
AppliedVersion implements projection.StateReader.
func (*FakeProjectionState) SetApplied ¶
func (f *FakeProjectionState) SetApplied(_ context.Context, tenantID, proj, aggregate, aggID string, version int64) error
SetApplied records that a projection has applied an aggregate version (implements projection.AppliedRecorder; the watermark never regresses).
type FakeRelational ¶
type FakeRelational struct {
// contains filtered or unexported fields
}
FakeRelational reads the world's shared memory, tenant-scoped from ctx.
func (*FakeRelational) GetMany ¶
GetMany implements the batched hydration contract: one logical lookup, results in ids order, missing ids skipped.
func (*FakeRelational) List ¶
func (r *FakeRelational) List(ctx context.Context, entity string, q query.ListQuery, into any) error
List implements equality-filtered paging.
type FakeSearch ¶
type FakeSearch struct {
// contains filtered or unexported fields
}
FakeSearch is a substring-matching search fake with version gating and ctx-tenant scoping.
func NewFakeSearch ¶
func NewFakeSearch(reg *registry.Registry) *FakeSearch
NewFakeSearch builds a search fake.
func (*FakeSearch) ApplyMutations ¶
func (s *FakeSearch) ApplyMutations(_ context.Context, _ string, muts []projection.Mutation) error
ApplyMutations implements the projection write path.
func (*FakeSearch) Search ¶
func (s *FakeSearch) Search(ctx context.Context, q query.SearchQuery, into any) error
Search implements substring match over the entity's declared fields, narrowed by the structured Filter, ordered by Sort (id when empty, since the fake has no relevance score) and paginated by Offset/Limit. It mirrors the ES adapter's neutral contract closely enough for unit tests; the integration suite is the source of truth for scoring and analysis.
type FakeSpatial ¶
type FakeSpatial struct {
// contains filtered or unexported fields
}
FakeSpatial is an exact in-memory geometry store that implements query.SpatialQuerier. It is tenant-scoped via ctx and safe for concurrent use. Distance computation is haversine for SRID 4326, planar Euclidean otherwise.
func (*FakeSpatial) Delete ¶
func (f *FakeSpatial) Delete(ctx context.Context, entity, id string) error
Delete implements query.SpatialQuerier.
func (*FakeSpatial) Get ¶ added in v0.0.5
func (f *FakeSpatial) Get(ctx context.Context, entity, id string) (geom query.Geometry, meta map[string]any, ok bool, err error)
Get implements query.SpatialQuerier. Returns ok=false (nil error) when the id is absent, out of scope, or stored as a non-point (NaN) geometry.
func (*FakeSpatial) Upsert ¶
func (f *FakeSpatial) Upsert(ctx context.Context, entity, id string, geom query.Geometry, meta map[string]any) error
Upsert implements query.SpatialQuerier.
func (*FakeSpatial) Within ¶
func (f *FakeSpatial) Within(ctx context.Context, q query.SpatialQuery, into any) error
Within implements query.SpatialQuerier. Results are scanned into *[]query.SpatialMatch, nearest-first; ties break by ID.
type FakeStore ¶
type FakeStore struct {
// contains filtered or unexported fields
}
FakeStore implements command.Store with real transactional semantics: changes stage into a snapshot and merge only on success, so batch atomicity behaves like the Postgres adapter.
func (*FakeStore) FailOnOutbox ¶
FailOnOutbox injects an outbox failure (nil to clear).
type FakeTS ¶
type FakeTS struct {
// contains filtered or unexported fields
}
FakeTS stores points per (tenant, series, key), time-sorted.
type FakeVector ¶
type FakeVector struct {
// contains filtered or unexported fields
}
FakeVector is an exact cosine-similarity store.
func (*FakeVector) Delete ¶
func (f *FakeVector) Delete(ctx context.Context, entity, id string) error
Delete implements query.VectorQuerier.
func (*FakeVector) DeleteByMeta ¶ added in v0.0.3
func (f *FakeVector) DeleteByMeta(ctx context.Context, entity string, filter map[string]string) error
DeleteByMeta implements query.VectorQuerier.
func (*FakeVector) Get ¶ added in v0.0.3
Get implements query.VectorQuerier. Returns a copy of the stored embedding for (entity, id), or *fabriqerr.NotFoundError on miss.
func (*FakeVector) Similar ¶
func (f *FakeVector) Similar(ctx context.Context, q query.VectorQuery, into any) error
Similar implements exact top-K cosine search.
type World ¶
type World struct {
Registry *registry.Registry
Store *FakeStore
Rel *FakeRelational
Graph *FakeGraph
Search *FakeSearch
TS *FakeTS
Vector *FakeVector
Spatial *FakeSpatial
Docs *FakeDocumentStore
Projections *FakeProjectionState
Blob *FakeBlob
Analytics *FakeAnalytics
}
World wires all fakes over one shared in-memory store, so a command executed against Store is immediately visible through Rel, and graph / search fakes can hydrate from the same rows.