@axinom/pg-grouped-attributes-plugin v0.0.1
PgGroupedAttributesPlugin
About
This package contains a plugin written for Postgraphile version 5.
When it's unnecessary to add one-to-one relationship but you still want create a group of attributes looks like an object type in GraphQL, this plugins comes to the rescue.
Let's say you have a table called posts with following columns.
| id | title | description |
|---|
Then you want to have a group columns to add meta tags of the posts. You could add a one-to-one table or add the columns to the same table above like below.
| id | title | description | og__title | og__description | og__image | og__url |
|---|
Without the plugin, Postgraphile will generate the GraphQL schema like below.
query Query ($id: String!) {
post (id: $id) {
id
title
description
ogTitle
ogDescription
ogImage
ogUrl
}
}But with the plugin in place, you can have it like this.
query Query ($id: String!) {
post (id: $id) {
id
title
description
og {
title
description
image
url
}
}
}11 months ago
12 months ago
7 months ago
9 months ago
6 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago