encore
encore copied to clipboard
Add a way to export enum-like types to generated clients
If you have a enum-like type
type Permissions int
const (
PermAdmin Permissions = 1 << (iota + 1)
PermListUsers Permissions = 1 << (iota +1)
PermGetUser
//. . .
)
and then generate a client encore gen client [project-id] -l [lang]
the generated client won't contain any of the available constants, I suggest a way to have an encore-type comment to tell the compiler to include the constants inside a certain block.
type Permissions int
//encore:gen [lang] <-------------------
const (
PermAdmin Permissions = 1 << (iota + 1)
PermListUsers Permissions = 1 << (iota +1)
PermGetUser
//. . .
)
with the constants being included in all languages unless a language is specified.