Skip to content

Commit

Permalink
docs: change readme
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasCaldewei committed Oct 3, 2023
1 parent 56e460a commit ccfb25f
Showing 1 changed file with 143 additions and 43 deletions.
186 changes: 143 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,200 @@

# Dynamometer
<p align="center">
<img src="logo.svg" width="200px" align="center" alt="Dynamometer logo" />
<h1 align="center">Dynamometer</h1>
<p align="center">
<br/>
Enforces single table design on your DynamoDB queries in an elegant way.
</p>
</p>

[![npm package][npm-img]][npm-url]
[![Build Status][build-img]][build-url]
[![Downloads][downloads-img]][downloads-url]
[![Issues][issues-img]][issues-url]
[![Code Coverage][codecov-img]][codecov-url]
[![Commitizen Friendly][commitizen-img]][commitizen-url]
[![Semantic Release][semantic-release-img]][semantic-release-url]

> A library to easily work with DynamoDB and enforces single table design approach.
# Introduction

Inspired by [Firestore SDK](https://firebase.google.com/docs/firestore).
---
Managing your data with a single design approach in DynamodDB can sometimes be difficult. Dynamometer uses so-called "
Collections" and "Docs" to structure your data in an comprehensible way.

![Dynamometer Logo](logo.svg)

Dynamometer simplifies the use of a single table design in your DynamoDB queries.

- [npm package](https://www.npmjs.com/package/dynamometer)
- [Build Status](https://github.com/AndreasCaldewei/dynamometer/actions/workflows/release.yml)
- [Downloads](https://www.npmtrends.com/dynamometer)
- [Issues](https://github.com/AndreasCaldewei/dynamometer/issues)
- [Code Coverage](https://codecov.io/gh/AndreasCaldewei/dynamometer)
- [Semantic Release](https://github.com/semantic-release/semantic-release)
- [Commitizen Friendly](http://commitizen.github.io/cz-cli/)

## Introduction
```ts
const db = Dynamometer.create({
tableName: "dataTable"
})
Dynamometer is intended for simple, low-complexity projects and is designed to allow an architect to immediately take a
single-table approach with a DynamoDB table without having to think much about access patterns.

db.collection('USERS')
.doc("xspvLRiJ")
.collection("TODOS")
.add({
text: "Makes managing your data a breeze."
})
# Features

Using a single design approach in DynamoDB can be challenging. Dynamometer introduces "Collections" and "Docs" to make your data more understandable. It's perfect for simple projects, allowing you to adopt a single-table approach without diving deep into access patterns.
```

## Features
---

- User-friendly API for querying and creating DynamoDB items.
- Automatic structuring of data in a single table design.
- Easy to use API to query and create items in DynamoDB.
- Data is automatically structured in single table design.
`

## Installation
---
# Install

## Install
---

```bash
npm install dynamometer
npm install dynamometer # npm
yarn add dynamometer # yarn
pnpm add dynamometer # pnpm
```

## Basic Usage
## Usage
# Basic usage

---

### Setting Up
Create a instance of the dynamometer client.

```ts
import { Dynamometer } from 'dynamometer';

const db = Dynamometer.create({
tableName: "dataTable"
});
})
```

### Collections
---

### Collection

Collections contain multiple items.
A collection holds a number of items.

#### Creating a collection

**Creating a Collection:**
```ts
const collection = db.collection("USERS");
const collection = db.collection("USERS")
```

**Adding an Item:**
With a collection, items can be added to it or all can be queried.

#### Adding an item

```ts

collection.add({
name: "John Doe"
});
})

```

**Querying All Items:**
#### Query all Items

```ts

const reponse = await collection.get()

```

#### Doc

If you know the ID of an item in the collection or you want to give it your own ID you can use the doc methode.

```ts
const response = await collection.get();
// get the doc
collection.doc("123").get()

// add the doc with the id 123
collection.doc("123").add({
name: "John Doe"
})
```

### Documents
---

### Document

A document is an item of a collection. It offers CRUD methodes.

#### Doc

If you know the ID of an item in the collection or you want to give it your own ID you can use the doc methode.

A document is an individual item within a collection.
#### Creating a document

**Accessing a Document by ID:**
```ts
const doc = db.collection("USERS").doc("123");
const doc = db.collection("USERS").doc("123")
```

**Setting Document Data:**
#### Set doc data

```ts
const response = await doc.set({
const repsonse = await doc.set({
name: "John Doe"
});
})
```

**Retrieving Document Data:**
#### Get doc data

```ts
const data = await doc.get();
const data = await doc.get()
```

**Updating a Document:**
#### Update doc

```ts
const response = await doc.update({
name: "John Doester"
});
})
```

**Deleting a Document:**
#### Delete doc

```ts
const response = await doc.delete();
const response = await doc.delete()
```

---
[build-img]:https://github.com/AndreasCaldewei/dynamometer/actions/workflows/release.yml/badge.svg

[build-url]:https://github.com/AndreasCaldewei/dynamometer/actions/workflows/release.yml

[downloads-img]:https://img.shields.io/npm/dt/dynamometer

[downloads-url]:https://www.npmtrends.com/dynamometer

[npm-img]:https://img.shields.io/npm/v/dynamometer

[npm-url]:https://www.npmjs.com/package/dynamometer

[issues-img]:https://img.shields.io/github/issues/AndreasCaldewei/dynamometer

[issues-url]:https://github.com/AndreasCaldewei/dynamometer/issues

[codecov-img]:https://codecov.io/gh/AndreasCaldewei/dynamometer/branch/main/graph/badge.svg

[codecov-url]:https://codecov.io/gh/AndreasCaldewei/dynamometer

[semantic-release-img]:https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg

[semantic-release-url]:https://github.com/semantic-release/semantic-release

[commitizen-url]:http://commitizen.github.io/cz-cli/


[commitizen-img]:https://img.shields.io/badge/commitizen-friendly-brightgreen.svg



0 comments on commit ccfb25f

Please sign in to comment.