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

Add a way to export enum-like types to generated clients #503

Open
shixzie opened this issue Nov 1, 2022 · 0 comments
Open

Add a way to export enum-like types to generated clients #503

shixzie opened this issue Nov 1, 2022 · 0 comments

Comments

@shixzie
Copy link

shixzie commented Nov 1, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant