type
LocalAPI
type LocalAPI = core.LocalAPIIn-process content operations over the shared operation engine.
CreateLocalAPI.Create- Create and validate a document.
DuplicateLocalAPI.Duplicate- Copy an authorized source and apply overrides.
FindLocalAPI.Find- Read one authorized document.
ListLocalAPI.List- List documents with filters, sorting, and population.
UpdateLocalAPI.Update- Update a document through the operation engine.
DeleteLocalAPI.Delete- Trash or delete an authorized document.
RestoreDeletedLocalAPI.RestoreDeleted- Move an authorized trashed document back into ordinary reads.
PublishLocalAPI.Publish- Publish a versioned document.
UnpublishLocalAPI.Unpublish- Return a versioned document to draft.
VersionsLocalAPI.Versions- Read authorized retained revisions.
RestoreLocalAPI.Restore- Restore a retained revision as the current published document.
Globalmethod- Read a global document.
UpdateGlobalmethod- Update a global document.
HookContext.Local reuses the active transaction during pre-commit phases. AfterCommit and AfterError run outside it, so nested calls start a new transaction. Application services normally access this API through app.Local().
Example
post, err := app.Local().Create(ctx, "posts", store.Values{
"title": store.String("Hello, Ridu"),
}, actor)
if err != nil {
return err
}Methods
LocalAPI.Create()Create and validate a document through the shared operation engine.
LocalAPI.CreateWithOptions()Create a document with draft, locale, population, and authorization options.
LocalAPI.Duplicate()Create a document from an access-checked source and apply overrides.
LocalAPI.DuplicateWithOptions()Duplicate a document with write and response options.
LocalAPI.Find()Read one authorized document.
LocalAPI.FindWithOptions()Read one document with projection, population, draft, trash, and locale controls.
LocalAPI.List()List authorized documents with filtering, pagination, projection, sorting, and population.
LocalAPI.Distinct()Return paginated unique values for one direct field after access checks.
LocalAPI.ListWindow()Read one count-free bounded unique-index range for reconciliation work.
LocalAPI.Update()Apply partial values to one authorized document.
LocalAPI.UpdateWithOptions()Update one document with optimistic concurrency and response controls.
LocalAPI.Delete()Delete an authorized document, moving it to trash when the collection enables trash.
LocalAPI.DeleteWithOptions()Delete a document with optimistic concurrency and response controls.
LocalAPI.RestoreDeleted()Move an authorized trashed document back into ordinary collection reads.
LocalAPI.DeletePermanent()Irreversibly remove an authorized document that is already in trash.
LocalAPI.Publish()Publish one authorized versioned document.
LocalAPI.PublishWithOptions()Publish a versioned document with optimistic concurrency and response controls.
LocalAPI.PublishChanges()Atomically apply field changes and publish the resulting versioned document through the publish lifecycle.
LocalAPI.PublishChangesWithOptions()Atomically apply field changes and publish with exact identity, concurrency, locale, and response controls.
LocalAPI.Unpublish()Move one authorized versioned document back to draft.
LocalAPI.UnpublishWithOptions()Unpublish a versioned document with optimistic concurrency and response controls.
LocalAPI.Versions()Return authorized retained revisions for one versioned document.
LocalAPI.Version()Return one authorized retained revision.
LocalAPI.Restore()Restore a retained revision as the current published document.
LocalAPI.RestoreAsDraft()Restore a retained revision while explicitly keeping the current document unpublished.
LocalAPI.RestoreVersionWithOptions()Restore a retained revision with explicit draft, concurrency, locale, and response controls.
LocalAPI.Import()Create a document with trusted source identity and timestamps.
LocalAPI.Capabilities()Evaluate collection, document, and field access without side effects.
LocalAPI.UpdateRevision()Update with an optimistic current-revision fence.
LocalAPI.MutateJoin()Atomically add and remove inverse-relation target IDs.
LocalAPI.CopyLocale()Copy every localized field from one locale to another.
LocalAPI.RestoreDeletedWithOptions()Restore a trashed document with exact actor and response controls.
LocalAPI.DeletePermanentWithOptions()Permanently delete a trashed document with exact actor controls.
LocalAPI.MutateJoinWithOptions()Atomically add and remove inverse-relation IDs with complete mutation controls.
LocalAPI.CopyLocaleWithOptions()Copy localized fields with exact identity, concurrency, and response controls.
LocalAPI.VersionsWithOptions()List retained document revisions with exact identity, locale, and response controls.
LocalAPI.VersionWithOptions()Read one retained document revision with exact identity and locale controls.
LocalAPI.BulkUpdate()Apply one partial update atomically to an explicit bounded ID set.
LocalAPI.BulkPublish()Publish an explicit bounded set of versioned documents atomically.
LocalAPI.BulkUnpublish()Unpublish an explicit bounded set of versioned documents atomically.
LocalAPI.BulkDelete()Delete or trash an explicit bounded set of documents atomically.
LocalAPI.BulkRestoreDeleted()Restore an explicit bounded set of trashed documents atomically.
LocalAPI.BulkDeletePermanent()Permanently delete an explicit bounded set of trashed documents atomically.
LocalAPI.EmptyTrash()Permanently delete the current authorized trash selection for one collection.
LocalAPI.Global()Read one authorized singleton.
LocalAPI.UpdateGlobal()Create or update one singleton.
LocalAPI.GlobalWithOptions()Read one authorized singleton with projection, population, draft, identity, and locale controls.
LocalAPI.UpdateGlobalWithOptions()Create or update a singleton with complete mutation and response controls.
LocalAPI.PublishGlobal()Publish one authorized versioned singleton.
LocalAPI.PublishGlobalWithOptions()Publish a singleton with complete mutation and response controls.
LocalAPI.PublishGlobalChanges()Atomically apply singleton field changes and publish through the global publish lifecycle.
LocalAPI.PublishGlobalChangesWithOptions()Atomically apply singleton field changes and publish with complete mutation and response controls.
LocalAPI.UnpublishGlobal()Move one authorized versioned singleton back to draft.
LocalAPI.UnpublishGlobalWithOptions()Unpublish a singleton with complete mutation and response controls.
LocalAPI.CopyGlobalLocale()Copy every localized singleton field from one locale to another.
LocalAPI.CopyGlobalLocaleWithOptions()Copy localized singleton fields with exact identity, concurrency, and response controls.
LocalAPI.GlobalVersionsWithOptions()List retained singleton revisions with exact identity and locale controls.
LocalAPI.GlobalVersion()Read one access-filtered retained singleton revision.
LocalAPI.GlobalVersionWithOptions()Read one retained singleton revision with exact identity and locale controls.
LocalAPI.RestoreGlobal()Restore a retained singleton revision as the current published value.
LocalAPI.RestoreGlobalAsDraft()Restore a retained singleton revision while keeping it unpublished.
LocalAPI.RestoreGlobalVersionWithOptions()Restore a retained singleton revision with explicit draft, identity, concurrency, and response controls.
LocalAPI.GlobalVersions()List access-filtered retained singleton revisions.