Closed ghost closed 6 years ago
We haven't tested an interop with other packages like kallax, but it should work reasonably well.
For example, from kallax docs, you need to embed a kallax.Model
into your type:
type User struct {
kallax.Model `table:"users" pk:"id"`
ID kallax.ULID
Username string
Email string
Password string
}
This will probably cause proteus to generate an undesired model
field in the protobuf definition.
But you can fix it by defining two separate types:
//proteus:generate
type User struct {
ID uint64
Username string
Email string
Password string
}
type DBUser struct{
kallax.Model `table:"users" pk:"id"`
User
}
And convert to the DB version of the struct when passing it to kallax: DBUser{User:u}
.
Hope this answers your question.
Thanks. It makes sense.
Will try it out.
Since both projects use golang structs as the source I presume that kallax and Proteus are designed to be used together ?