Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/owengombas/graphql-composer-typeorm
🌐 TypeORM plugin for graphql-composer-decorators
https://github.com/owengombas/graphql-composer-typeorm
api decorators graphql query sql typeorm
Last synced: about 1 month ago
JSON representation
🌐 TypeORM plugin for graphql-composer-decorators
- Host: GitHub
- URL: https://github.com/owengombas/graphql-composer-typeorm
- Owner: owengombas
- License: mit
- Created: 2020-06-21T18:27:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T09:31:11.000Z (about 2 years ago)
- Last Synced: 2024-10-30T14:09:50.846Z (3 months ago)
- Topics: api, decorators, graphql, query, sql, typeorm
- Language: TypeScript
- Homepage:
- Size: 1.74 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
graphql-composer-decorators
Create your GraphQL API using decorators!
# graphql-composer-decorators
GraphQL comes to revolutionize backend development, the fact that you have to declare types is something very useful, however it can lead to code duplication and therefore affect the stability of your application. Indeed, based on the DRY (Don't Repeat Yourself) principle, the fact of declaring several times the same element in a different way should be avoided, because when this element changes it is necessary to modify several parts of code, so if only one of these parts is omitted it can cause problems in your application and the more it grows the harder it will be to maintain it.### [Go to the documentation](https://owencalvin.github.io/graphql-composer-decorators/)
# graphql-composer
The `graphql-composer-decorators` module is broken down into two modules instead of making one heavier, `graphql-composer` simply provides a compositing API which allows you to create an API using the builder design pattern and compositing.
> Documentation for this module will be available soon.# graphql-composer-typeorm
This solution offers a way to create advanced queries with TypeORM and graphql-composer-decorators# `ArgsFactory`
This class allows to generate complex arguments from a class, the arguments will be generated in order to be able to specify several parameters for certain types:## `string`
### `eq`
strictly equal value
### `like`
expression value## `number`
### `eq`
strictly equal value
### `gt`
strictly higher value
### `gte`
greater or equal value
### `lt`
strictly speaking, smaller value
### `lte`
lesser or equal value# `Parser`
This class allows you to generate the SQL query via your arguments:# Example
```ts
const args = ArgsFactory.create(User)@Resolver()
class Resolver {
@Query()
query(
Args(args) args: KeyValue,
ctx: Context
): Response {
const query = parser.buildQuery(ctx);
return query.getMany();
}
}
```