mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
* defined json node * query json field test * activated json node in ASQL * renamed test * replaced dedicated node with existing 'nested' node * added abstract sql json node * test for conversion * another jest test * added test for picking an attribute which is an array * randomized values in test * converted from tree to path list Co-authored-by: Brainslug <br41nslug@users.noreply.github.com> * added a column index per json path * skip TDD tests for now * adjusted abstract sql json type Co-authored-by: Nicola Krumschmidt <nickrum@users.noreply.github.com> Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com> * overall field conversion test for json Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de> * one node per json path * removed empty lines * fixed linter * integrated json node conversion * integrated json conversion * renamed variable * enhanced test and fixed bug Co-authored-by: Brainslug <tim@brainslug.nl> * randomized values for test * fixed func call * test for json select in driver * simple json support in driver * moved json path into the list of parameters * used operator in pg driver to return an object by key * fixed tests * fixed circular dep * finalized test in driver * renamed node * renamed interface type * Simplify json path accumulation Co-authored-by: Jan Arends <jaads@users.noreply.github.com> * Move object type to its own file * Rename object type name for consistency * Improve variable naming in test * Fix formatting --------- Co-authored-by: Brainslug <br41nslug@users.noreply.github.com> Co-authored-by: Nicola Krumschmidt <nickrum@users.noreply.github.com> Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com> Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de> Co-authored-by: Brainslug <tim@brainslug.nl> Co-authored-by: Jan Arends <jaads@users.noreply.github.com>
@directus/data
Warning
This is a work in progress. Nothing is expected to work yet.
Installation
npm install @directus/data
The installation of a driver is also required.
Usage
Setup
import { DataEngine } from '@directus/data';
import { DataDriverPostgres } from '@directus/data-driver-postgres';
// Instantiate the engine
const engine = new DataEngine();
// Instantiate a driver
const pgDriver = new DataDriverPostgres({
connectionString: 'postgresql://root:password@localhost/mydb',
});
// register the driver to the engine
await engine.registerStore('postgres', pgDriver);
Query data
// query data
await engine.query({
store: 'postgres',
collection: 'articles',
fields: [
{
type: 'primitive',
field: 'id',
},
],
});
The above is resulting in the following flow.
graph TB;
api --> data
subgraph da[data abstraction]
direction TB
data --> data-driver-x --> db1[(datastore)]
data --> data-driver-y --> db2[(datastore)]
end
Current architecture of this package
To get an overview of how the package is organized regarding it's files, directories and the dependencies between them,
run pnpm run depcruise and have a look in the created dependency-graph.svg image.