graphjin 3.0.9 → 3.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -6
- package/package.json +1 -1
- package/wasm/graphjin.wasm +0 -0
package/README.md
CHANGED
|
@@ -4,12 +4,58 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/graphjin)
|
|
5
5
|
[](https://hub.docker.com/r/dosco/graphjin/builds)
|
|
6
6
|
[](https://discord.gg/6pSWCTZ)
|
|
7
|
-
[](https://pkg.go.dev/github.com/dosco/graphjin/
|
|
8
|
-
[](https://goreportcard.com/report/github.com/dosco/graphjin/
|
|
7
|
+
[](https://pkg.go.dev/github.com/dosco/graphjin/core/v3)
|
|
8
|
+
[](https://goreportcard.com/report/github.com/dosco/graphjin/core/v3)
|
|
9
9
|
|
|
10
10
|
## Build APIs in 5 minutes not weeks
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Just use a simple GraphQL query to define your API and GraphJin automagically converts it into SQL and fetches the data you need. Build your backend APIs **100X** faster. Works with **NodeJS** and **GO**. Supports several databases, **Postgres**, **MySQL**, **Yugabyte**, **AWS Aurora/RDS** and **Google Cloud SQL**
|
|
13
|
+
|
|
14
|
+
The following GraphQL query fetches a list of products, their owners, and other category information, including a cursor for retrieving more products.
|
|
15
|
+
GraphJin would do auto-discovery of your database schema and relationships and generate the most efficient single SQL query to fetch all this data including a cursor to fetch the next 20 times. You don't have to do a single thing besides write the GraphQL query.
|
|
16
|
+
|
|
17
|
+
```graphql
|
|
18
|
+
query getProducts {
|
|
19
|
+
products(
|
|
20
|
+
# returns only 20 items
|
|
21
|
+
limit: 20
|
|
22
|
+
|
|
23
|
+
# orders the response items by highest price
|
|
24
|
+
order_by: { price: desc }
|
|
25
|
+
|
|
26
|
+
# only items with a price >= 20 and < 50 are returned
|
|
27
|
+
where: { price: { and: { greater_or_equals: 20, lt: 50 } } }
|
|
28
|
+
) {
|
|
29
|
+
id
|
|
30
|
+
name
|
|
31
|
+
price
|
|
32
|
+
|
|
33
|
+
# also fetch the owner of the product
|
|
34
|
+
owner {
|
|
35
|
+
full_name
|
|
36
|
+
picture: avatar
|
|
37
|
+
email
|
|
38
|
+
|
|
39
|
+
# and the categories the owner has products under
|
|
40
|
+
category_counts(limit: 3) {
|
|
41
|
+
count
|
|
42
|
+
category {
|
|
43
|
+
name
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# and the categories of the product itself
|
|
49
|
+
category(limit: 3) {
|
|
50
|
+
id
|
|
51
|
+
name
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
# also return a cursor that we can use to fetch the next
|
|
55
|
+
# batch of products
|
|
56
|
+
products_cursor
|
|
57
|
+
}
|
|
58
|
+
```
|
|
13
59
|
|
|
14
60
|
## Secure out of the box
|
|
15
61
|
|
|
@@ -83,12 +129,12 @@ console.log("Express server started on port %s", server.address().port);
|
|
|
83
129
|
|
|
84
130
|
## Use with GO
|
|
85
131
|
|
|
86
|
-
You can use GraphJin as a library within your own code. The [serv](https://pkg.go.dev/github.com/dosco/graphjin/
|
|
132
|
+
You can use GraphJin as a library within your own code. The [serv](https://pkg.go.dev/github.com/dosco/graphjin/serv/v3) package exposes the entirely GraphJin standlone service as a library while the [core](https://pkg.go.dev/github.com/dosco/graphjin/core/v3) package exposes just the GraphJin compiler. The [Go docs](https://pkg.go.dev/github.com/dosco/graphjin/tests/v3#pkg-examples) are filled with examples on how to use GraphJin within your own apps as a sort of alternative to using ORM packages. GraphJin allows you to use GraphQL and the full power of GraphJin to access your data instead of a limiting ORM.
|
|
87
133
|
|
|
88
134
|
### Use GraphJin Core
|
|
89
135
|
|
|
90
136
|
```console
|
|
91
|
-
go get github.com/dosco/graphjin/
|
|
137
|
+
go get github.com/dosco/graphjin/core/v3
|
|
92
138
|
```
|
|
93
139
|
|
|
94
140
|
```golang
|
|
@@ -100,7 +146,7 @@ import (
|
|
|
100
146
|
"fmt"
|
|
101
147
|
"log"
|
|
102
148
|
|
|
103
|
-
"github.com/dosco/graphjin/core/
|
|
149
|
+
"github.com/dosco/graphjin/core/v3"
|
|
104
150
|
_ "github.com/jackc/pgx/v4/stdlib"
|
|
105
151
|
)
|
|
106
152
|
|
package/package.json
CHANGED
package/wasm/graphjin.wasm
CHANGED
|
Binary file
|