npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@webiny/db-dynamodb

v5.41.1

Published

A DynamoDB driver for the @webiny/db database client.

Downloads

4,509

Readme

@webiny/db-dynamodb

code style: prettier PRs Welcome

A set of frequently used data-dynamodb higher order functions.

For more information, please visit the official docs.

Install

yarn add @webiny/db-dynamodb

Helper functions

We have a number helper functions that ease the use of either dynamodb-toolbox, filtering, sorting or just creating proper response.

batchRead

Read a batch of records from the DynamoDB table.

This function accepts table and items, an array of objects created by Entity.getBatch().

Internally it reads records until there are no more to read and returns a list of read records.

batchWrite

Write a batch of records to the DynamoDB table.

This function accepts table and items, an array of objects created by Entity.putBatch(). It also accepts a number which defines a number of items to be written in one request. DO NOT put that number over the official DynamoDB maximum.

Internally it loops through the items received (in chunks of maxChunks parameter) and does not return anything.

cleanupItem and cleanupItems

Clean up records received from the DynamoDB table.

This function accepts entity and item to be cleaned up, in case of the cleanupItem. In case of cleanupItems it accepts an array of items to clean up.

We use this to remove the properties that dynamodb-toolbox puts on the record automatically.

get

Get a single record from the DynamoDB table with given keys.

This function accepts entity and keys to fetch the record by.

It returns either record or null. By default, entity.get() returns a object with some meta data and Item property, which contains the record (or null if no record).

queryOne and queryAll

Query the DynamoDB table for record(s) by given partition key and query options.

This function accepts entity to perform the query on, partitionKey to query by and options to define the query parameters with.

The queryAll method accepts limit, a number with which you can load only a certain amount of records. The queryOne method does not have that property.

filter

Filter the DynamoDB records by given where condition.

This function accepts items (records) to be filtered, a definition of fields to filter by (not required by default if no field modification is required), where conditions (eg. {published: true, date_gte: "2021-01-01"}) and filtering plugins.

sort

Sort the DynamoDB records by given sort condition.

This function accepts items (records) to be sorted, sort options (eg. createdBy_ASC, id_DESC, etc.) and a definitions of fields to sort by (not required by default if no field modification is required).