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

Entproto custom message type #4023

Open
MarcosBustamante opened this issue Apr 17, 2024 · 0 comments
Open

Entproto custom message type #4023

MarcosBustamante opened this issue Apr 17, 2024 · 0 comments

Comments

@MarcosBustamante
Copy link

Hi,

my project is using a Json that is not currently supported by entproto in the gen process.

My idea was to build a custom proto message in a separated proto file and import this file generated file in order to use something more type safe. The final ent code would looks like this:

field.
	JSON("costs", map[string]interface{}{}).
	Optional().
	Comment(`
		This includes brokerage fees, stock exchange fees and taxes. The costs 
		should be divided by 100 to get the real value, e.g. 1000 means R$ 10,00.
	`).
	Annotations(entproto.Field(
		2, 
		entproto.Type(descriptorpb.FieldDescriptorProto_TYPE_MESSAGE),
		entproto.TypeName("Cost"),
	)),

lets say that my proto file that defines the Cost type is named cost.proto. How can I import cost.proto in the auto gen file in order to enable the type cost.Cost message to be recognized by the protoc command?

Thanks

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