-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add mechanism for generating public query functions and types #287
Comments
I would default to being public, if a user really wants to keep it private he can place it under an internal directory so that it's public to external packages. |
* -pubtypes make the generated types public * -pubfuncs makes the generated functions public * -jsontag add a `json:”...”` field tag Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
Public by default seems reasonable, but I think there should still be a way to make them private to a package. In a large enough project it is reasonable to want to restrict some things more than just |
Hello, a little question, @fmoor, triying use the flag -pubfuncs not working, I suppose is not in the current release, can you help me to pass private to public, without modify generated files? |
This is not implemented yet. You can achieve the same thing by putting this in a non generated file in the same package. var MyQueryFunc = myQueryFunc I'll try to get this implemented soon. |
pubtypes generates a public struct but its fields are all private if the fields in the .esdl are lower case. Is best practice to name those fields so they will be generated so they are public or generate the return type by default with public fields if you use pubtypes? |
Yes. In EdgeQL it is possible to have both a select schema::Function {
Name := .name,
Language := .language,
Params := .params {
Name := .name,
Default := .default,
}
} You could also define your types with mixed caps names so you don't need to rename everything in every query. |
I don't think there is an established best practice here. For most schemas it is probably easiest to use |
Thanks, that helped clarify the behavior |
The new |
Currently
edgeql-go
generates private query functions and return types. The user can export these types but it requires a few lines of code for each query. There should be a way to make the generator generate public instead of private functions and types.Maybe this should be configurable on a per query basis?
The text was updated successfully, but these errors were encountered: