Interface: ActionCtx<DataModel>
server.ActionCtx
If you're using code generation, use the ActionCtx
type in
convex/_generated/server.d.ts
which is typed for your data model.
If you need an unparameterized ActionCtx use GenericActionCtx.
Deprecated
Type parameters
Name | Type |
---|---|
DataModel | extends GenericDataModel = GenericDataModel |
Hierarchy
-
GenericActionCtx
<DataModel
>↳
ActionCtx
Properties
scheduler
• scheduler: Scheduler
A utility for scheduling Convex functions to run in the future.
Inherited from
Defined in
auth
• auth: Auth
Information about the currently authenticated user.
Inherited from
Defined in
storage
• storage: StorageActionWriter
A utility for reading and writing files in storage.
Inherited from
Defined in
Methods
runQuery
▸ runQuery<Query
>(query
, ...args
): Promise
<FunctionReturnType
<Query
>>
Run the Convex query with the given name and arguments.
Consider using an internalQuery to prevent users from calling the query directly.
Type parameters
Name | Type |
---|---|
Query | extends FunctionReference <"query" , "public" | "internal" > |
Parameters
Name | Type | Description |
---|---|---|
query | Query | A FunctionReference for the query to run. |
...args | OptionalRestArgs <Query > | The arguments to the query function. |
Returns
Promise
<FunctionReturnType
<Query
>>
A promise of the query's result.
Inherited from
Defined in
runMutation
▸ runMutation<Mutation
>(mutation
, ...args
): Promise
<FunctionReturnType
<Mutation
>>
Run the Convex mutation with the given name and arguments.
Consider using an internalMutation to prevent users from calling the mutation directly.
Type parameters
Name | Type |
---|---|
Mutation | extends FunctionReference <"mutation" , "public" | "internal" > |
Parameters
Name | Type | Description |
---|---|---|
mutation | Mutation | A FunctionReference for the mutation to run. |
...args | OptionalRestArgs <Mutation > | The arguments to the mutation function. |
Returns
Promise
<FunctionReturnType
<Mutation
>>
A promise of the mutation's result.
Inherited from
Defined in
runAction
▸ runAction<Action
>(action
, ...args
): Promise
<FunctionReturnType
<Action
>>
Run the Convex action with the given name and arguments.
Consider using an internalAction to prevent users from calling the action directly.
Type parameters
Name | Type |
---|---|
Action | extends FunctionReference <"action" , "public" | "internal" > |
Parameters
Name | Type | Description |
---|---|---|
action | Action | A FunctionReference for the action to run. |
...args | OptionalRestArgs <Action > | The arguments to the action function. |
Returns
Promise
<FunctionReturnType
<Action
>>
A promise of the action's result.
Inherited from
Defined in
vectorSearch
▸ vectorSearch<TableName
, IndexName
>(tableName
, indexName
, query
): Promise
<{ _id
: GenericId
<TableName
> ; _score
: number
}[]>
Run a vector search on the given table and index.
Type parameters
Name | Type |
---|---|
TableName | extends string |
IndexName | extends string | number | symbol |
Parameters
Name | Type | Description |
---|---|---|
tableName | TableName | The name of the table to query. |
indexName | IndexName | The name of the vector index on the table to query. |
query | Object | A VectorSearchQuery containing the vector to query, the number of results to return, and any filters. |
query.vector | number [] | The query vector. This must have the same length as the dimensions of the index. This vector search will return the IDs of the documents most similar to this vector. |
query.limit? | number | The number of results to return. If specified, must be between 1 and 256 inclusive. Default ts 10 |
query.filter? | (q : VectorFilterBuilder <DocumentByInfo <NamedTableInfo <DataModel , TableName >>, NamedVectorIndex <NamedTableInfo <DataModel , TableName >, IndexName >>) => FilterExpression <boolean > | Optional filter expression made up of q.or and q.eq operating over the filter fields of the index. e.g. filter: q => q.or(q.eq("genre", "comedy"), q.eq("genre", "drama")) |
Returns
Promise
<{ _id
: GenericId
<TableName
> ; _score
: number
}[]>
A promise of IDs and scores for the documents with the nearest vectors