Skip to content

a2d24/dynamodb-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributing

Contributions are welcome.

Getting started

To work on the dynamodb-counter codebase, you'll want to clone the project locally and install the required dependencies via poetry.

> git clone git@github.com:a2d24/dynamodb-counter.git

Installation

> pip install dynamodb-counter[boto]

Quickstart

from dynamodb_counter import Counter

# This will attempt to create a boto3 dynamodb client using any ENV variables (eg AWS_PROFILE)
# You may pass in a custom client using the client kwarg (see source code)

counter = Counter(table='test-table', PK='users', SK='count')

# Reset the counter
assert counter.reset() == 0

# Get the next counter value
assert counter.next() == 1

# Custom increment
assert counter.next(increment=5) == 6

# Set counter to specific value
assert counter.set(12) == 12
assert counter.next() == 13

Documentation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages