@aws-sdk/util-dynamodb
Installation
NPM
npm install @aws-sdk/util-dynamodb
Yarn
yarn add @aws-sdk/util-dynamodb
pnpm
pnpm add @aws-sdk/util-dynamodb
This package provides utilities to be used with @aws-sdk/client-dynamodb
If you are looking for DynamoDB Document client, please check @aws-sdk/lib-dynamodb which automatically performs the necessary marshalling and unmarshalling.
Convert JavaScript object into DynamoDB Record
const { DynamoDB } = require("@aws-sdk/client-dynamodb");
const { marshall } = require("@aws-sdk/util-dynamodb");
const client = new DynamoDB(clientParams);
const params = {
TableName: "Table",
Item: marshall({
HashKey: "hashKey",
NumAttribute: 1,
BoolAttribute: true,
ListAttribute: [1, "two", false],
MapAttribute: { foo: "bar" },
NullAttribute: null,
}),
};
await client.putItem(params);
Convert DynamoDB Record into JavaScript object
const { DynamoDB } = require("@aws-sdk/client-dynamodb");
const { marshall, unmarshall } = require("@aws-sdk/util-dynamodb");
const client = new DynamoDB(clientParams);
const params = {
TableName: "Table",
Key: marshall({
HashKey: "hashKey",
}),
};
const { Item } = await client.getItem(params);
unmarshall(Item);
Types
Type Name | Type |
---|
Type Name | Type |
---|---|
convertToAttr | Variable |
convertToNative | Variable |
marshall1 | Function |
marshall10 | Function |
marshall11 | Function |
marshall12 | Function |
marshall13 | Function |
marshall14 | Function |
marshall15 | Function |
marshall16 | Function |
marshall17 | Function |
marshall18 | Function |
marshall19 | Function |
marshall2 | Function |
marshall3 | Function |
marshall4 | Function |
marshall5 | Function |
marshall6 | Function |
marshall7 | Function |
marshall8 | Function |
marshall9 | Function |
marshallOptions | Interface |
NativeAttributeBinary | TypeAlias |
NativeAttributeValue | TypeAlias |
NativeScalarAttributeValue | TypeAlias |
NumberValue | Interface |
NumberValueImpl | Class |
unmarshall | Variable |
unmarshallOptions | Interface |