Versions in this module Expand all Collapse all v1 v1.0.1 Jul 31, 2026 v1.0.0 Jul 22, 2026 Changes in this version + const CodeDocumentExists + const CodeDocumentNotFound + const CodeDocumentStale + const CodeInvalidToken + const CodeReadMemberStale + const CodeSearchNotFound + const CodeTokenExpired + const CodeUnauthenticated + const CodeVersionMismatch + const CodeWrongMachine + func AppendCachedRefOp(arrayField, collection, id string) map[string]any + func BuildCommand(word, target, parm string, detail any) (string, error) + func BuildCommandOrdered(word, target, parm string, detail ojson.JSONValue) (string, error) + func IsAppCode(err error, code string) bool + func JoinErrors(errs ...error) error + func NewDocumentID() string + func NewOperationID() string + func PatchDetailAppendingCachedRef(schemaMarker, version, arrayField, refCollection, refID string) map[string]any + type APIError struct + Actual ojson.JSONValue + Code string + Expected ojson.JSONValue + Message string + Path string + type AppError struct + BaseURL string + Code string + Collection string + Command string + ConfigVersion int + CorrectServer string + Errors []APIError + ID string + Message string + Result Result + ShardSlot string + func (e *AppError) Error() string + type CatalogError struct + Mismatches []CatalogMismatch + func (e *CatalogError) Error() string + type CatalogMismatch struct + Actual int + Code CatalogMismatchCode + Collection string + Expected int + type CatalogMismatchCode string + const CatalogCollectionNotFound + const CatalogSchemaVersionMismatch + type Client struct + func New(cfg Config) (*Client, error) + func (c *Client) CachedEstablishment() *Establishment + func (c *Client) Close() error + func (c *Client) Command(ctx context.Context, baseURL, line string) (Result, error) + func (c *Client) Create(ctx context.Context, collection, id string, content map[string]any) (WriteResult, error) + func (c *Client) Delete(ctx context.Context, collection, id string, detail map[string]any) (WriteResult, error) + func (c *Client) Establish(ctx context.Context, cols ...CollectionRef) error + func (c *Client) Health(ctx context.Context) (Result, error) + func (c *Client) Patch(ctx context.Context, collection, id string, detail map[string]any) (WriteResult, error) + func (c *Client) PatchWithVersionRetry(ctx context.Context, collection, id string, ...) (WriteResult, error) + func (c *Client) Read(ctx context.Context, collection, id string, opts *ReadOptions) (ReadResult, error) + func (c *Client) Ready(ctx context.Context) (Result, error) + func (c *Client) ResolveDirectRef(ctx context.Context, ref string, opts *ReadOptions) (ReadResult, error) + func (c *Client) ResolveRefsInSOT(ctx context.Context, sot ojson.JSONValue, maxDepth int) (map[string]ReadResult, error) + func (c *Client) Schema(ctx context.Context, collection string, version int) (Result, error) + func (c *Client) Search(ctx context.Context, collection, searchName string, vars map[string]any, ...) (SearchResult, error) + type Collection struct + Name string + Version int + func MustCollection[T any](name string, schemaVersion int) Collection[T] + func (c Collection[T]) CollectionName() string + func (c Collection[T]) SchemaMarker() string + func (c Collection[T]) SchemaVersion() int + func (col Collection[T]) Bind(c *Client) (CollectionClient[T], error) + type CollectionClient struct + func (cc CollectionClient[T]) Client() *Client + func (cc CollectionClient[T]) Collection() Collection[T] + func (cc CollectionClient[T]) CompiledSchema() ojson.JSONSchema + func (cc CollectionClient[T]) CreateDoc(ctx context.Context, id *string, doc T) (WriteResult, error) + func (cc CollectionClient[T]) CreatePatch(item CollectionItem[T], patch ojson.Patch) (CollectionPatch[T], error) + func (cc CollectionClient[T]) CreatePatchFromChanges(item CollectionItem[T]) (CollectionPatch[T], error) + func (cc CollectionClient[T]) DeleteDoc(ctx context.Context, item CollectionItem[T]) (WriteResult, error) + func (cc CollectionClient[T]) GetDoc(ctx context.Context, id string) (CollectionItem[T], error) + func (cc CollectionClient[T]) GetDocOpts(ctx context.Context, id string, opts *ReadOptions) (CollectionItem[T], error) + func (cc CollectionClient[T]) PatchDoc(ctx context.Context, patch CollectionPatch[T]) (WriteResult, error) + type CollectionItem struct + CacheSummaries ojson.JSONValue + Doc T + ExtraFields ojson.JSONValue + Meta DocMeta + OriginalDoc T + Result Result + type CollectionPatch struct + Patch ojson.Patch + func (p CollectionPatch[T]) ID() string + func (p CollectionPatch[T]) Version() string + type CollectionRef interface + CollectionName func() string + SchemaVersion func() int + type Config struct + BaseURLRewrite map[string]string + CreateAmbiguousVerifyDelay time.Duration + EstablishmentURL string + HTTPClient *http.Client + PreferServer string + Token string + TokenSource TokenSource + TransportRetries int + UserAgent string + WrongMachineRetries int + type DocMeta struct + ID string + Schema string + Version string + type Establishment struct + Auth ojson.JSONValue + Env ojson.JSONValue + General GeneralConfig + Schemas map[string]SchemaEntry + Searches ojson.JSONValue + Servers map[string]ServerEntry + ShardMap map[string]ShardAssignment + func (e *Establishment) AssignmentForSlot(slot byte) (ShardAssignment, bool) + func (e *Establishment) ServerBaseURL(name string) string + type GeneralConfig struct + CacheUpdateCheckinSeconds int + EstablishmentServer string + Name string + ReadMemberCheckinSeconds int + ReadMemberFailedCheckinsBeforeStale int + Version int + type ReadOptions struct + CacheSummaries bool + ExtraFields bool + type ReadResult struct + CacheSummaries ojson.JSONValue + Collection string + ExtraFields ojson.JSONValue + ID string + Result Result + SOT ojson.JSONValue + func (rr ReadResult) SummariesForArrayField(arrayField string) ([]ojson.JSONValue, error) + type Result struct + Body []byte + Env ojson.JSONValue + Errors []APIError + OK bool + func DecodeResult(body []byte) (Result, error) + func (r Result) FirstErrorCode() string + func (r Result) IntField(key string) int + func (r Result) StringField(key string) string + func (r Result) ValueField(key string) ojson.JSONValue + type Route struct + BaseURL string + ServerName string + Slot byte + SlotHex string + type RouteKind int + const RouteRead + const RouteWrite + type SchemaEntry struct + Doc ojson.JSONValue + Version int + type SearchResult struct + Collection string + Matches []string + Result Result + Search string + type ServerEntry struct + BaseURL string + type ShardAssignment struct + ProxyReadMember []string + ShardReadMember []string + ShardSOTMember string + type StaticToken string + func (s StaticToken) Token(context.Context) (string, error) + type TokenSource interface + Token func(ctx context.Context) (string, error) + type TransportError struct + Body string + Err error + StatusCode int + func (e *TransportError) Error() string + func (e *TransportError) Unwrap() error + type WriteResult struct + Collection string + ID string + OperationID string + Result Result + Schema string + Version string + VersionBefore string Other modules containing this package github.com/JohnAD/datorium-client-go/v2