Skip to content

Releases: hasura/ndc-sdk-go

v1.6.2

11 Nov 04:07
0310e6b
Compare
Choose a tag to compare

What's Changed

  • utils: support more formats for the parseDateTime function by @hgiasac in #167
  • utils: add DecodeDateReflection function by @hgiasac in #168
  • utils: accept both env and value as default by @hgiasac in #169

Full Changelog: v1.6.1...v1.6.2

v1.6.1

04 Nov 14:41
7b41e67
Compare
Choose a tag to compare

What's Changed

  • cli: skip validating scalar result types by @hgiasac in #165
  • utils: add options for time and duration decoding helpers by @hgiasac in #166

Full Changelog: v1.6.0...v1.6.1

v1.6.0

29 Oct 07:54
3b6d7ce
Compare
Choose a tag to compare

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

07 Oct 09:52
e6a7fd8
Compare
Choose a tag to compare

What's Changed

  • cmd: should upgrade the latest SDK after introspection by @hgiasac in #155

Full Changelog: v1.5.0...v1.5.1

v1.5.0

06 Oct 16:10
6d47f47
Compare
Choose a tag to compare

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

  • support concurrency for query and mutations and add http server settings by @hgiasac in #154

Full Changelog: v1.4.1...v1.5.0

v1.4.1

02 Oct 02:36
229d467
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.4.0...v1.4.1

v1.4.0

27 Sep 07:33
c31575e
Compare
Choose a tag to compare

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 the connector.generated.go file. Connector authors can customize the connector codes as they wish.

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

20 Sep 04:35
f6093ca
Compare
Choose a tag to compare

What's Changed

  • misc: make the connector Tracer compatible with the origin interface by @hgiasac in #141
  • fix: float decoding from string by @hgiasac in #142
  • fix: ignore the OpenTelemetry merging resources error by @hgiasac in #146

Full Changelog: v1.3.0...v1.3.1

v1.3.0

22 Aug 08:02
73b2c5d
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.2.5...v1.3.0

v0.7.0

22 Aug 07:01
0b415c6
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.6.5...v0.7.0