Created
June 17, 2020 11:31
-
-
Save juliankoehn/5b0ae858210659373fb3a36921dd7acf to your computer and use it in GitHub Desktop.
ideas for the prisma go client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package prisma | |
type EntityQuery struct { | |
QueryInterface | |
} | |
// implementing into model struct | |
// not as INTERFACE, to use inheritance. | |
// we can still customize funcs if needed | |
// on model level | |
type QueryInterface struct { | |
Set(value string) SetParams | |
SetOptional(value..) SetParams | |
Equals(...) ParamInterface | |
In(values ...string) ParamInterface | |
} | |
// EntityName is set on EntityQuery | |
func (*EntityQuery) EntityName() string { | |
return "entityName" | |
} | |
[...] | |
func (q EntityQuery) Set(value string) SetParams { | |
return SetParams{ | |
data: builder.Field{ | |
Name: q.EntityName(), | |
Value: value, | |
} | |
} | |
} | |
[...] | |
// Generated Code => | |
// type localeParams struct { | |
// data builder.Field | |
// query builder.Query | |
// } | |
// | |
type EntityParams struct { | |
ParamInterface | |
} | |
// returns exactly the same among all models | |
// if funcs should be differnt, they still can be overwritten | |
type ParamInterface struct { | |
data builder.Field | |
query builder.Query | |
} | |
func (*ParamInterface) field() builder.Field | |
func (*ParamInterface) getQuery() builder.Query | |
func (*EntityParams) entityModel() | |
type SetParams interface {} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
=> missing interface implementations... <.<