Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beameryedge/querycraft-pipelines
Create Database agnostic aggregations base on data pipelines
https://github.com/beameryedge/querycraft-pipelines
data-pipeline querycraft querycraft-filter-builder querycraft-pipelines
Last synced: 7 days ago
JSON representation
Create Database agnostic aggregations base on data pipelines
- Host: GitHub
- URL: https://github.com/beameryedge/querycraft-pipelines
- Owner: BeameryEdge
- License: mit
- Created: 2017-12-11T14:41:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T15:11:46.000Z (over 1 year ago)
- Last Synced: 2024-04-18T09:39:05.287Z (7 months ago)
- Topics: data-pipeline, querycraft, querycraft-filter-builder, querycraft-pipelines
- Language: TypeScript
- Size: 240 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# QueryCraft-Pipelines
Database agnostic formulation for data pipelines[![NPM](https://nodei.co/npm/QueryCraft-Pipelines.png)](https://npmjs.org/package/querycraft-pipelines)
[![npm version](https://badge.fury.io/js/querycraft-pipelines.svg)](https://badge.fury.io/js/querycraft-pipelines)
[![codecov](https://codecov.io/gh/BeameryHQ/QueryCraft-Pipelines/branch/master/graph/badge.svg)](https://codecov.io/gh/BeameryHQ/QueryCraft-Pipelines)
[![Known Vulnerabilities](https://snyk.io/test/github/beameryhq/QueryCraft-Pipelines/badge.svg)](https://snyk.io/test/github/beameryhq/QueryCraft-Pipelines)## Installation
```sh
npm install --save 'querycraft-pipelines'
```## Examples
Suppose we have a collection of data that satisfies the interface
```ts
interface contact {
id: string
'list': { id: string }[]
firstName: string
lastName: string
email: string
createdAt: Date
customFields: { id: string, value: number }[]
assignedTo?: string
}
```If we want an aggregations the describes the logic:-
```where
fistName is bob
lastName is doyle OR is not set
assignedTo is anything
list has an item where id is item1
Group by
the value property of the customField where id is custom1```
We can build build it as easily as:-
```ts
import { FilterBuilder, eq, lt, neq, any, find, where } from 'querycraft'
import { Pipeline } from 'querycraft-pipelines'const contacts: contact[] = [ ... ]
const pipeline = new Pipeline()
.filter(
where('firstName', eq('bob'))
.where('list', find(where('id', eq('item1'))))
.where('lastName', any([
eq('doyle'),
eq(null)
]))
.where('createdAt', lt({ daysAgo: 5 }))
.where('assignedTo', neq(null))
)
.buckets({
fieldId: 'CustomFields',
subFieldIds: ['custom1'],
subFieldProp: 'value',
})```