GCP.Datastore reference
Commit
Section titled “Commit”Source:
src/GCP/Datastore/Commit.ts
Runtime binding for Datastore projects.commit.
Bind this operation to a Datastore-mode GCP.Firestore.Database in a Function/Action init
phase. Provide CommitHttp. The bound database supplies the
project and database id; mutations run against that database only.
The host is granted the role on the project under an IAM Condition
matching the database.
Commit: Committing Mutations
Section titled “Commit: Committing Mutations”const database = yield* GCP.Firestore.Database("Tasks", { type: "DATASTORE_MODE",});const commit = yield* GCP.Datastore.Commit(database);const result = yield* commit({ body: { mode: "NON_TRANSACTIONAL", mutations: [ { upsert: { key: { path: [{ kind: "Task", name: "t1" }] }, properties: { title: { stringValue: "Ship" } }, }, }, ], },});CommitHttp
Section titled “CommitHttp”Source:
src/GCP/Datastore/CommitHttp.tsKind: Layer · Provides:GCP.Datastore.Commit
HTTP implementation of Commit.
Source:
src/GCP/Datastore/Indexes.ts
A Cloud Datastore composite index.
Indexes apply to the project’s default Datastore-mode database. The index id is assigned by the API. Kind, ancestor mode, and properties are immutable — changing them replaces the index. Indexes have no labels field, so Alchemy tracks an index by the id in state; without state an index with the same definition is adopted when its kind is the generated one and reported as unowned otherwise.
Index: Creating an Index
Section titled “Index: Creating an Index”Composite index on a kind
const index = yield* GCP.Datastore.Index("TasksByDone", { kind: "Task", ancestor: "NONE", properties: [ { name: "done", direction: "ASCENDING" }, { name: "priority", direction: "DESCENDING" }, ],});Ancestor index
const index = yield* GCP.Datastore.Index("CommentsByCreated", { kind: "Comment", ancestor: "ALL_ANCESTORS", properties: [ { name: "created", direction: "DESCENDING" }, { name: "author", direction: "ASCENDING" }, ],});Lookup
Section titled “Lookup”Source:
src/GCP/Datastore/Lookup.ts
Runtime binding for Datastore projects.lookup.
Bind this operation to a Datastore-mode GCP.Firestore.Database in a Function/Action init
phase. Provide LookupHttp. The bound database supplies the
project and database id; lookups run against that database only.
The host is granted the role on the project under an IAM Condition
matching the database.
Lookup: Looking Up Entities
Section titled “Lookup: Looking Up Entities”const database = yield* GCP.Firestore.Database("Tasks", { type: "DATASTORE_MODE",});const lookup = yield* GCP.Datastore.Lookup(database);const result = yield* lookup({ body: { keys: [{ path: [{ kind: "Task", name: "t1" }] }], },});LookupHttp
Section titled “LookupHttp”Source:
src/GCP/Datastore/LookupHttp.tsKind: Layer · Provides:GCP.Datastore.Lookup
HTTP implementation of Lookup.
RunQuery
Section titled “RunQuery”Source:
src/GCP/Datastore/RunQuery.ts
Runtime binding for Datastore projects.runQuery.
Bind this operation to a Datastore-mode GCP.Firestore.Database in a Function/Action init
phase. Provide RunQueryHttp. The bound database supplies the
project and database id; queries run against that database only.
The host is granted the role on the project under an IAM Condition
matching the database.
RunQuery: Querying Entities
Section titled “RunQuery: Querying Entities”const database = yield* GCP.Firestore.Database("Tasks", { type: "DATASTORE_MODE",});const runQuery = yield* GCP.Datastore.RunQuery(database);const page = yield* runQuery({ body: { query: { kind: [{ name: "Task" }] } },});RunQueryHttp
Section titled “RunQueryHttp”Source:
src/GCP/Datastore/RunQueryHttp.tsKind: Layer · Provides:GCP.Datastore.RunQuery
HTTP implementation of RunQuery.