0.3.1 • Published 6 months ago

@winglibs/dynamodb v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

dynamodb

Prerequisites

Installation

npm i @winglibs/dynamodb

Usage

bring dynamodb;

let table = new dynamodb.Table(
  attributes: [
    {
      name: "id",
      type: "S",
    },
  ],
  hashKey: "id",
);

// Streams.
table.setStreamConsumer(inflight (record) => {
  log("record processed = {Json.stringify(record)}");
});

// Put and query.
test "put and query" {
  table.put(
    Item: {
      id: "1",
      body: "hello",
    },
  );
  let response = table.query(
    KeyConditionExpression: "id = :id",
    ExpressionAttributeValues: {":id": "1"},
  );
  assert(response.Count == 1);
  assert(response.Items[0]["id"].asStr() == "1");
  assert(response.Items[0]["body"].asStr() == "hello");
}

In case you want to instantiate your own DynamoDB SDK, you can get the connection details like this:

table.connection.clientConfig.endpoint;
table.connection.clientConfig.credentials;
table.connection.clientConfig.region;
table.connection.tableName;

So you can use the AWS SDK DynamoDB client like this:

new DynamoDB(table.connection.clientConfig);

License

This library is licensed under the MIT License.

0.3.1

6 months ago

0.3.0

10 months ago

0.2.3

11 months ago

0.2.2

11 months ago

0.2.4

10 months ago

0.1.20

12 months ago

0.2.1

12 months ago

0.2.0

12 months ago

0.1.19

12 months ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.16

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.4

1 year ago

0.1.5

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.3

1 year ago

0.1.0

1 year ago

0.0.8

1 year ago

0.0.5

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago