@aws-sdk/util-dynamodb
TypeScript icon, indicating that this package has built-in type declarations

3.616.0 • Public • Published

@aws-sdk/util-dynamodb

NPM version NPM downloads

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);

Readme

Keywords

none

Package Sidebar

Install

npm i @aws-sdk/util-dynamodb

Weekly Downloads

1,905,624

Version

3.616.0

License

Apache-2.0

Unpacked Size

53.6 kB

Total Files

25

Last publish

Collaborators

  • mattsb42-aws
  • kuhe
  • amzn-oss
  • aws-sdk-bot
  • trivikr-aws