-
-
Notifications
You must be signed in to change notification settings - Fork 158
Description
Is your feature request related to a problem? Please describe.
Adding convenience methods to generated model types is possible, by locating a file alongside the generated file. This allows me to, for example, create
// foo_conversion.go beside /db/jet/my_db/public/model/foo.go
func (a *Foo) ToProto() *pb.FooMessage {
return &pb.FooMessage{
PropA: a.PropA,
EnumB: a.EnumB.String(),
SomeNumber: a.SomeNumber.BigInt().Uint64(),
//...
}
}
so in my code, when I'm transforming a database row (model type) into a proto for a gRPC response, I can just say myFoo.ToProto()
. Dealing with model types becomes vastly cleaner in calling code, when I can add these methods to do conversions, or other operations on them.
However, when I regenerate the files, the generator just blows away the jet directory entirely, forcing me to ensure I don't have uncommitted/indexed changes in my files
Describe the solution you'd like
I would like the generator, when re-generating, to be more careful about what it deletes - instead of a bulk deletion of the directory, scan the directory and delete empty directories and files which are marked as generated by jet.