Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: reusable code generation #145

Merged
merged 33 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
67b36c7
feat: add go schema-format
hgiasac Sep 15, 2024
9074eab
refactor generated codes
hgiasac Sep 16, 2024
0ee9c13
add --type-only mode
hgiasac Sep 17, 2024
dd5c218
update README
hgiasac Sep 17, 2024
849003d
remove deprecated codes
hgiasac Sep 17, 2024
f7136f1
fix unit tests
hgiasac Sep 17, 2024
34f9e29
improve unit tests
hgiasac Sep 17, 2024
e67b360
auto inspect state argument
hgiasac Sep 18, 2024
5f71f2f
improve connector templates
hgiasac Sep 18, 2024
bea9969
fix merge schema utils
hgiasac Sep 19, 2024
3cb6812
fix merge schema utils
hgiasac Sep 19, 2024
e9f33d2
add unit tests for MergeSchemas util
hgiasac Sep 19, 2024
f55da96
wip: embed
hgiasac Sep 20, 2024
9604adf
Merge branch 'main' into cli/generate-schema-codes-2
hgiasac Sep 21, 2024
85efdcd
support embeded field decoder
hgiasac Sep 21, 2024
4fff7ae
add NewTracer function
hgiasac Sep 22, 2024
70e0ff6
fix connector generation
hgiasac Sep 22, 2024
5095a03
fix connector generation
hgiasac Sep 22, 2024
ca079ee
fix unit tests
hgiasac Sep 22, 2024
9808dac
rename render functions
hgiasac Sep 22, 2024
b8b8827
rename connector_Decoder
hgiasac Sep 22, 2024
a5ee3b7
fix not null response
hgiasac Sep 22, 2024
1488b43
fix enum
hgiasac Sep 22, 2024
625f6d0
remove dedundant decoding functions
hgiasac Sep 23, 2024
ef9010e
generate suffixes for duplicated object names
hgiasac Sep 23, 2024
1d49f8b
add warn message if using go workspace
hgiasac Sep 23, 2024
111afb3
fix unit tests
hgiasac Sep 24, 2024
659886a
fix unit tests
hgiasac Sep 24, 2024
a915fcb
fix unit tests
hgiasac Sep 24, 2024
9a5f186
fix unit tests
hgiasac Sep 24, 2024
bf965d0
fix merge map
hgiasac Sep 24, 2024
74a03de
add README
hgiasac Sep 24, 2024
d4d1eee
move logs of /health and /metrics paths to debug level
hgiasac Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions cmd/hasura-ndc-go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,26 @@ go install github.com/hasura/ndc-sdk-go/cmd/hasura-ndc-go@latest

```bash
❯ hasura-ndc-go -h
Usage: hasura-ndc-go <command>
Usage: hasura-ndc-go <command> [flags]

Flags:
-h, --help Show context-sensitive help.
-h, --help Show context-sensitive help.
--log-level="info" Log level ($HASURA_PLUGIN_LOG_LEVEL).

Commands:
new --name=STRING --module=STRING
new --name=STRING --module=STRING [flags]
Initialize an NDC connector boilerplate. For example:

hasura-ndc-go new -n example -m github.com/foo/example

update
update [flags]
Generate schema and implementation for the connector from functions.

test snapshots
generate snapshots [flags]
Generate test snapshots.

version [flags]
Print the CLI version.
```

### Initialize connector project
Expand All @@ -60,6 +64,9 @@ hasura-ndc-go new -n example -m github.com/foo/example -o .

### Generate queries and mutations

> [!IMPORTANT]
> If neither function nor procedure is generated your project may use Go workspace. You need to add the submodule path to the `go.work` file.

The `update` command parses code in the `functions` folder, finds functions and types that are allowed to be exposed and generates the following files:

- `schema.generated.json`: the generated connector schema in JSON format.
Expand Down
Loading