dynatron
Version:
The most advanced ORM for AWS DynamoDB
67 lines (66 loc) • 2.69 kB
TypeScript
import { UpdateItemOutput } from "@aws-sdk/client-dynamodb";
import { NativeAttributeValue } from "@aws-sdk/util-dynamodb";
import { Check } from "../_core/items-check";
import { NativeValue } from "../../dynatron";
import { BUILD } from "../../utils/misc-utils";
export type UpdateAdd = {
kind: "add";
attributePath: string;
value: Set<string | number> | number;
};
export type UpdateAppend = {
kind: "append";
attributePath: string;
value: NativeAttributeValue | NativeAttributeValue[];
createIfAttributePathDoesNotExist: boolean;
};
export type UpdateDelete = {
kind: "delete";
attributePath: string;
value: Set<string | number>;
};
export type UpdateIncrement = {
kind: "increment";
attributePath: string;
value: number;
};
export type UpdatePrepend = {
kind: "prepend";
attributePath: string;
value: NativeAttributeValue | NativeAttributeValue[];
createIfAttributePathDoesNotExist: boolean;
};
export type UpdateRemove = {
kind: "remove";
attributePath: string;
};
export type UpdateSet = {
kind: "set";
attributePath: string;
value: NativeAttributeValue;
ifDoesNotExist: boolean;
};
export type UpdateType = UpdateAdd | UpdateAppend | UpdateDelete | UpdateIncrement | UpdatePrepend | UpdateRemove | UpdateSet;
export declare class Update extends Check {
#private;
assign(value: NativeValue, ifDoesNotExist?: boolean): this;
increment(attributePath: string, value?: number, createIfAttributePathDoesNotExist?: boolean): this;
decrement(attributePath: string, value?: number, createIfAttributePathDoesNotExist?: boolean): this;
append(attributePath: string, values: NativeAttributeValue[], createIfAttributePathDoesNotExist?: boolean): this;
prepend(attributePath: string, values: NativeAttributeValue[], createIfAttributePathDoesNotExist?: boolean): this;
add(attributePath: string, values: Set<string | number>): this;
delete(attributePath: string, values: Set<string | number>): this;
drop(attributePath: string): this;
[BUILD](): {
_UpdateExpressions?: UpdateType[] | undefined;
ReturnValues: import("@aws-sdk/client-dynamodb").ReturnValue;
_ConditionExpressions?: import("../..").Condition[] | undefined;
_Key?: NativeValue | undefined;
ReturnItemCollectionMetrics?: import("@aws-sdk/client-dynamodb").ReturnItemCollectionMetrics | undefined;
ReturnConsumedCapacity: import("@aws-sdk/client-dynamodb").ReturnConsumedCapacity;
TableName: string | undefined;
};
$: <T = NativeValue | undefined>() => Promise<{
data: T | undefined;
} & Omit<UpdateItemOutput, "Attributes">>;
}