Skip to content

Commit 51e486c

Browse files
committed
Initial commit
1 parent 40fa1e6 commit 51e486c

File tree

14 files changed

+4881
-0
lines changed

14 files changed

+4881
-0
lines changed

.github/workflows/cicd.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI/CD
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Build and test
11+
run: |
12+
yarn
13+
yarn run build
14+
yarn run codegen
15+
- name: Publish NPM package
16+
if: startsWith(github.ref, 'refs/tags/v')
17+
env:
18+
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
19+
run: |
20+
npm version --no-git-tag-version "${GITHUB_REF##refs/tags/}"
21+
echo "$NPM_TOKEN" > .npmrc
22+
npm publish --access public
23+
rm .npmrc

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
/dist/
3+
/pkg/
4+
*.tsbuildinfo

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# GraphQL Code Generator plugin for generating Golang
2+
3+
| This package is work in progress. Contributions are welcome <3.
4+
5+
This package generates Golang types and requests which use:
6+
7+
- [encoding/json](https://pkg.go.dev/encoding/json)
8+
- [net/http](https://pkg.go.dev/net/http)
9+
10+
## Install
11+
12+
The package is published to [graphql-codegen-golang](https://www.npmjs.com/package/graphql-codegen-golang).
13+
14+
```
15+
npm install -D graphql-codegen-golang
16+
yarn install -D graphql-codegen-golang
17+
```
18+
19+
## Usage: `codegen.yaml`
20+
21+
```yaml
22+
hooks:
23+
afterAllFileWrite: go fmt
24+
25+
schema: graphql/schema.graphql
26+
documents: graphql/documents/**/*.graphql
27+
generates:
28+
gen/output.go:
29+
plugins:
30+
- graphql-codegen-golang
31+
```
32+
33+
## Configuration
34+
35+
None for now.
36+
37+
## License
38+
39+
MIT

graphql.config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
schema: graphql/schema.graphql
2+
documents:
3+
- graphql/!(schema).graphql
4+
- main.go
5+
extensions:
6+
codegen:
7+
hooks:
8+
afterAllFileWrite: go fmt
9+
generates:
10+
pkg/graphql/graphql.go:
11+
plugins:
12+
- dist/index.js

graphql/document.graphql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
query GetCloudProviders {
2+
CloudProviders {
3+
id
4+
}
5+
}

graphql/schema.graphql

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
schema {
2+
query: query_root
3+
subscription: subscription_root
4+
}
5+
6+
# columns and relationships of "CloudProviders"
7+
type CloudProviders {
8+
id: uuid!
9+
name: name!
10+
}
11+
12+
# Boolean expression to filter rows from the table "CloudProviders". All fields are combined with a logical 'AND'.
13+
input CloudProviders_bool_exp {
14+
_and: [CloudProviders_bool_exp]
15+
_not: CloudProviders_bool_exp
16+
_or: [CloudProviders_bool_exp]
17+
id: uuid_comparison_exp
18+
name: name_comparison_exp
19+
}
20+
21+
# ordering options when selecting data from "CloudProviders"
22+
input CloudProviders_order_by {
23+
id: order_by
24+
name: order_by
25+
}
26+
27+
# primary key columns input for table: "CloudProviders"
28+
input CloudProviders_pk_columns_input {
29+
id: uuid!
30+
}
31+
32+
# select columns of table "CloudProviders"
33+
enum CloudProviders_select_column {
34+
# column name
35+
id
36+
37+
# column name
38+
name
39+
}
40+
41+
# expression to compare columns of type String. All fields are combined with logical 'AND'.
42+
input String_comparison_exp {
43+
_eq: String
44+
_gt: String
45+
_gte: String
46+
_ilike: String
47+
_in: [String!]
48+
_is_null: Boolean
49+
_like: String
50+
_lt: String
51+
_lte: String
52+
_neq: String
53+
_nilike: String
54+
_nin: [String!]
55+
_nlike: String
56+
_nsimilar: String
57+
_similar: String
58+
}
59+
60+
# columns and relationships of "Users"
61+
type Users {
62+
id: String!
63+
}
64+
65+
# Boolean expression to filter rows from the table "Users". All fields are combined with a logical 'AND'.
66+
input Users_bool_exp {
67+
_and: [Users_bool_exp]
68+
_not: Users_bool_exp
69+
_or: [Users_bool_exp]
70+
id: String_comparison_exp
71+
}
72+
73+
# ordering options when selecting data from "Users"
74+
input Users_order_by {
75+
id: order_by
76+
}
77+
78+
# primary key columns input for table: "Users"
79+
input Users_pk_columns_input {
80+
id: String!
81+
}
82+
83+
# select columns of table "Users"
84+
enum Users_select_column {
85+
# column name
86+
id
87+
}
88+
89+
scalar name
90+
91+
# expression to compare columns of type name. All fields are combined with logical 'AND'.
92+
input name_comparison_exp {
93+
_eq: name
94+
_gt: name
95+
_gte: name
96+
_in: [name!]
97+
_is_null: Boolean
98+
_lt: name
99+
_lte: name
100+
_neq: name
101+
_nin: [name!]
102+
}
103+
104+
# column ordering options
105+
enum order_by {
106+
# in the ascending order, nulls last
107+
asc
108+
109+
# in the ascending order, nulls first
110+
asc_nulls_first
111+
112+
# in the ascending order, nulls last
113+
asc_nulls_last
114+
115+
# in the descending order, nulls first
116+
desc
117+
118+
# in the descending order, nulls first
119+
desc_nulls_first
120+
121+
# in the descending order, nulls last
122+
desc_nulls_last
123+
}
124+
125+
# query root
126+
type query_root {
127+
# fetch data from the table: "CloudProviders"
128+
CloudProviders(
129+
# distinct select on columns
130+
distinct_on: [CloudProviders_select_column!]
131+
132+
# limit the number of rows returned
133+
limit: Int
134+
135+
# skip the first n rows. Use only with order_by
136+
offset: Int
137+
138+
# sort the rows by one or more columns
139+
order_by: [CloudProviders_order_by!]
140+
141+
# filter the rows returned
142+
where: CloudProviders_bool_exp
143+
): [CloudProviders!]!
144+
145+
# fetch data from the table: "CloudProviders" using primary key columns
146+
CloudProviders_by_pk(id: uuid!): CloudProviders
147+
148+
# fetch data from the table: "Users"
149+
Users(
150+
# distinct select on columns
151+
distinct_on: [Users_select_column!]
152+
153+
# limit the number of rows returned
154+
limit: Int
155+
156+
# skip the first n rows. Use only with order_by
157+
offset: Int
158+
159+
# sort the rows by one or more columns
160+
order_by: [Users_order_by!]
161+
162+
# filter the rows returned
163+
where: Users_bool_exp
164+
): [Users!]!
165+
166+
# fetch data from the table: "Users" using primary key columns
167+
Users_by_pk(id: String!): Users
168+
}
169+
170+
# subscription root
171+
type subscription_root {
172+
# fetch data from the table: "CloudProviders"
173+
CloudProviders(
174+
# distinct select on columns
175+
distinct_on: [CloudProviders_select_column!]
176+
177+
# limit the number of rows returned
178+
limit: Int
179+
180+
# skip the first n rows. Use only with order_by
181+
offset: Int
182+
183+
# sort the rows by one or more columns
184+
order_by: [CloudProviders_order_by!]
185+
186+
# filter the rows returned
187+
where: CloudProviders_bool_exp
188+
): [CloudProviders!]!
189+
190+
# fetch data from the table: "CloudProviders" using primary key columns
191+
CloudProviders_by_pk(id: uuid!): CloudProviders
192+
193+
# fetch data from the table: "Users"
194+
Users(
195+
# distinct select on columns
196+
distinct_on: [Users_select_column!]
197+
198+
# limit the number of rows returned
199+
limit: Int
200+
201+
# skip the first n rows. Use only with order_by
202+
offset: Int
203+
204+
# sort the rows by one or more columns
205+
order_by: [Users_order_by!]
206+
207+
# filter the rows returned
208+
where: Users_bool_exp
209+
): [Users!]!
210+
211+
# fetch data from the table: "Users" using primary key columns
212+
Users_by_pk(id: String!): Users
213+
}
214+
215+
scalar uuid
216+
217+
# expression to compare columns of type uuid. All fields are combined with logical 'AND'.
218+
input uuid_comparison_exp {
219+
_eq: uuid
220+
_gt: uuid
221+
_gte: uuid
222+
_in: [uuid!]
223+
_is_null: Boolean
224+
_lt: uuid
225+
_lte: uuid
226+
_neq: uuid
227+
_nin: [uuid!]
228+
}

0 commit comments

Comments
 (0)