Releases: hasura/ndc-sdk-go
Releases · hasura/ndc-sdk-go
v1.6.2
v1.6.1
v1.6.0
Highlights
Support generating generic type parameters and ignore unexported fields in the struct:
type GetCustomHeadersArguments[T any, S int | int8 | int16 | int32 | int64] struct {
Headers map[string]string `json:"headers"`
Input *T `json:"input"`
Other *GetCustomHeadersOther[S] `json:"other"`
}
type GetCustomHeadersOther[T int | int8 | int16 | int32 | int64] struct {
Value T `json:"value"`
}
type GetCustomHeadersResult[T any, O int | int8 | int16 | int32 | int64] struct {
Headers map[string]string `json:"headers"`
Response T
Other *GetCustomHeadersOther[O] `json:"other"`
}
func FunctionGetCustomHeaders(ctx context.Context, state *types.State, arguments *GetCustomHeadersArguments[BaseAuthor, int]) (GetCustomHeadersResult[HelloResult, int64], error) {
// ...
}
Support options of the json tag:
omitempty
: if this option is set, the field schema will be nullable even if the field type isn't a pointer.-
the object field is ignored.
type SomeObject struct {
Headers map[string]string `json:"omitempty"`
IgnoredField string `json:"-"`
}
What's Changed
- utils: Expose reflection decode utilities by @hgiasac in #156
- utils: fix non-null return types for decoding utilities and improve linter by @hgiasac in #157
- cli: support generating generic type parameters by @hgiasac in #158
- cli: support
omitempty
and ignore-
json tags by @hgiasac in #159 - utils: add environment value utilities by @hgiasac in #161
- utils: add
Duration
scalar by @hgiasac in #162 - utils: use the ParseDuration function of prometheus model by @hgiasac in #163
- cli: improve generic decoders and type generation by @hgiasac in #164
Full Changelog: v1.5.1...v1.6.0
v1.5.1
What's Changed
Full Changelog: v1.5.0...v1.5.1
v1.5.0
SDK
Add more settings to configure timeout, max header bytes, and TLS for the HTTP server
--server-read-timeout=DURATION Maximum duration for reading the entire request, including the body. A zero or negative value means there will be no timeout
($HASURA_SERVER_READ_TIMEOUT)
--server-read-header-timeout=DURATION Amount of time allowed to read request headers. If zero, the value of ReadTimeout is used ($HASURA_SERVER_READ_HEADER_TIMEOUT)
--server-write-timeout=DURATION Maximum duration before timing out writes of the response. A zero or negative value means there will be no timeout
($HASURA_SERVER_WRITE_TIMEOUT)
--server-idle-timeout=DURATION Maximum amount of time to wait for the next request when keep-alives are enabled. If zero, the value of ReadTimeout is used
($HASURA_SERVER_IDLE_TIMEOUT)
--server-max-header-kilobytes=1024 Maximum number of kilobytes the server will read parsing the request header's keys and values, including the request line
($HASURA_SERVER_MAX_HEADER_KILOBYTES)
--server-tls-cert-file=STRING Path of the TLS certificate file ($HASURA_SERVER_TLS_CERT_FILE)
--server-tls-key-file=STRING Path of the TLS key file ($HASURA_SERVER_TLS_KEY_FILE)
Go Connector
Add concurrency settings to the Go connector that executes operations in parallel if the request has many variables (query) or operations (mutation).
Name | Description | Default Value |
---|---|---|
QUERY_CONCURRENCY |
The limit of concurrent query executions by name if there are many request variables in a single request wit h format <key1>=<value1>;<key2>=<value2> |
|
QUERY_CONCURRENCY_LIMIT |
The limit of concurrent query executions if there are many request variables in a single request | 1 |
MUTATION_CONCURRENCY_LIMIT |
The limit of concurrent mutation executions if there are many operations in a single request | 1 |
What's Changed
Full Changelog: v1.4.1...v1.5.0
v1.4.1
v1.4.0
Code generation improvements
- Support embedded fields.
- If neither function nor procedure is generated, your project may use Go workspace. In this case, the CLI will print a warning to ask you to add the submodule path to the
go.work
file. - Make code generation reusable for other connector libraries:
- Support the snake_case naming style for operation names via the
--style=snake-case
flag. - Generate the connector schema to Go code via the the-
-schema-format=go
flag (example). - Generate handlers in the same package as defined functions. The
connector.generated.go
file simply imports those handlers to execute the logic. - Add a new
--type-only
flag to skip generating theconnector.generated.go
file. Connector authors can customize the connector codes as they wish.
- Support the snake_case naming style for operation names via the
What's Changed
- feat: Restructure the cli codebase by @hgiasac in #143
- feat: support operation naming style snake_case by @hgiasac in #144
- fix: Ignore OpenTelemetry resources merging error (#146) by @hgiasac in #147
- cli: reusable code generation by @hgiasac in #145
- feat: Add semantic HTTP attributes to server spans by @hgiasac in #149
Full Changelog: v1.3.1...v1.4.0
v1.3.1
v1.3.0
What's Changed
- Add
URL
scalar and remove redundant codes (#134) by @hgiasac in #135 - Upgrade OpenTelemetry SDK v1.28 and allow error interface generation by @hgiasac in #136
- Support ndc-spec 0.1.6 by @hgiasac in #138
Full Changelog: v1.2.5...v1.3.0
v0.7.0
What's Changed
- Add
URL
scalar and remove redundant codes by @hgiasac in #134 - Support ndc-spec 0.1.6 by @hgiasac in #137
Full Changelog: v0.6.5...v0.7.0