Files
directus/packages/data-sql
Nicola Krumschmidt 1aaf3fc218 Add support for filtering using a json object as target to durus (#21455)
* Add support for nested object target to abstract query

Co-authored-by: Jan Arends <jaads@users.noreply.github.com>

* Implement nested object target conversion

* added parameters in tests

* tiny refactoring

* test for json filter

* test and fix

* json value as filter target

* fixed mixed props and column name

* support for deeply nested filtering

* casting for filtering against numbers within a json

* another test

* linter fix

* split up set condition nodes

Co-authored-by: Nicola Krumschmidt <nickrum@users.noreply.github.com>

* added json target support for geo and set condition

Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de>

* linter fixes

* reverted json target for geo condition

* test for comparing field with primitive

* removed geo condition test

* Fix type issue

* Remove double cast to integer

* Implement stringification of order by with json

* Fix spelling error

* Clean up field condition node stringification

* Cast numbers to numeric type instead of integer

* Implement stringification of json geo condition

* Flip around string condition type check

* Refactor number condition stringification

* Refactor set number condition stringification

* Refactor set string condition stringification

* Rename comparisonValue to compareValue for consistency

* test for geo condition with json target

* utility for target conversion

* Convert json target in order by node as object

* test for json target in order by

---------

Co-authored-by: Jan Arends <jaads@users.noreply.github.com>
Co-authored-by: Jan Arends <jan.arends@mailbox.org>
Co-authored-by: Nicola Krumschmidt <nickrum@users.noreply.github.com>
2024-02-28 14:40:11 +01:00
..
2023-09-26 21:14:27 +08:00

@directus/data-sql

A package which all SQL drivers use. Is consists out of three individual parts:

  • A set of types, which defines the abstract SQL query language.
  • A query converter, which converts an abstract query into the abstract SQL query.
  • A database response converter which converts the flat database response into a nested object in regards to tables that have been joined. It also replaces the actual column name from the database, with an user specified alias if one was provided.
  • Some smaller utility functions, like for converting operators into SQL equivalents

Installation

npm install @directus/data-sql

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.