Go


Glue supports go as a code generation target, allowing you to generate Go structs and enums from Glue models.

Simply run:

shell

#Configuration

You can configure the emitted package name:

yaml

#Example

For this Glue spec:

glue

...generating Go...

shell

...will produce code similar to:

go

#Notes

  • Optional fields are emitted as pointers and include ,omitempty in JSON tags.
  • int/uint and fixed-width integer primitives emit their Go equivalents (int, uint, int8, uint64, etc.).
  • Unions are emitted as interface{}.
  • Record<K, V> is emitted as map[K]V.
  • Tuples with arity 2 through 4 are emitted as generated TupleN[...] helper types that marshal as JSON arrays; larger tuples fall back to fixed [N]interface{} arrays.
  • Glue type aliases are emitted as exported Go aliases when their generated names are exported. Aliases starting with _ are inlined instead.
  • Anonymous structs are emitted as generated structs named from the owning field path.