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

Plugins: Methods for generated types #231

Open
abhinav opened this issue Sep 19, 2016 · 2 comments
Open

Plugins: Methods for generated types #231

abhinav opened this issue Sep 19, 2016 · 2 comments

Comments

@abhinav
Copy link
Contributor

abhinav commented Sep 19, 2016

Plugins should be able to generate methods for generated types. They will likely need access to information about the types themselves.

@hlin117
Copy link
Contributor

hlin117 commented Sep 19, 2017

It would be nice if there were nice ways to map thrift enums to thrift enum pointers.

For example, if I have

enum ActionType {
    ENUM_ONE  = 1
    ENUM_TWO = 2 
    ENUM_THREE = 3
}

It would be nice if thrift-rw created a method called

func (a ActionType) Ptr() *ActionType {
    // Implementation here
}

@abhinav
Copy link
Contributor Author

abhinav commented Sep 27, 2017

@hlin117 We could do this natively instead of through a plugin.

The namespace of methods attached to an enum type is controlled completely by
us so there are no concerns about conflicts. I see the value of that method
since you can't take pointers to consts otherwise.

Can you create a separate issue for this? Further, if you feel motivated, we
would welcome a PR implementing that. It should be pretty straightforward.
Otherwise, we'll be able to get to it as priorities allow.

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

2 participants