Documentation
¶
Overview ¶
Package storetest is the contract every brain store must meet. Run it from a store's own tests (MemoryStore and postgres.Store do), so a new store or store method cannot ship without the same tenant, tree and search rules.
Two tenants share one store. Each case asserts what a caller gets under its own scope: its own rows, ErrNotFound for another tenant's ids, and an error for an empty scope. A store owns its embedding, so the contract hands newStore the Embedder a case needs (nil: lexical only).
Index ¶
- Constants
- func Filter(t testing.TB, m map[string]any) brain.Filter
- func Kind(ctx context.Context, s brain.Store, name string) (brain.ObjectKind, error)
- func Namespace(t testing.TB, nv ...string) brain.Namespace
- func Put(s brain.Store, obj brain.Object) error
- func Run(t *testing.T, newStore func(t *testing.T, emb brain.Embedder) brain.Store)
- type Embedder
Constants ¶
const Dimension = 3
Dimension is the length of every vector Embedder returns.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Embedder ¶
type Embedder struct {
// contains filtered or unexported fields
}
Embedder embeds a text as the vector of the first word of a synonym group in it (car and automobile share one vector, banana and fruit another; anything else is a third), counts every text it embeds, and fails on a text with the word poison.