Skip to content

Commit

Permalink
[FEAT] Scan Command at Dynamo DAO (#215)
Browse files Browse the repository at this point in the history
* feat: scan command at dynamo dao

* feat: scan command at dynamo dao

* fix: scan func params

* chore: package version
  • Loading branch information
marcofeliponi authored Feb 16, 2024
1 parent fc32aa1 commit f1a83e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adapcon-utils-js",
"version": "1.1.0",
"version": "1.1.1",
"description": "Utils library for Javascript",
"keywords": [],
"author": {
Expand Down
8 changes: 7 additions & 1 deletion src/dao/dynamo/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type {
BatchWriteCommandInput,
BatchWriteCommandOutput
} from '@aws-sdk/lib-dynamodb'
import { DynamoDB } from '@aws-sdk/client-dynamodb'
import { DynamoDB, ScanCommand } from '@aws-sdk/client-dynamodb'

const getOptions = () => {
if (process.env.IS_OFFLINE) return { region: 'localhost', endpoint: 'http://localhost:8000' }
Expand Down Expand Up @@ -59,6 +59,11 @@ const query = async <T>({
return items
}

const scan = async (params) => {
const command = new ScanCommand(params)
return documentInstance.send(command)
}

const getAll = async ({ params, list, fields = [] }: { params: DynamodbParams, list: object[], fields?: string[] }) => {
let idx = 0

Expand Down Expand Up @@ -338,6 +343,7 @@ const mountProjectionExpression = ({ fields = [], options }: { fields?: string[]
export const dynamoDBGenericDao = {
get,
query,
scan,
getAll,
put,
update,
Expand Down

0 comments on commit f1a83e9

Please sign in to comment.