Can't call Create(...) using types other than int, int64, UUID or string for primary key #605
Labels
s: triage
Some tests need to be run to confirm the issue
Milestone
Description
Not sure if I am missing something but it appears I cannot call Create(...) with types other than the ones mentioned above.
I'd like to be able to. I have an
ID
type that wraps a few fields, one being a uuid. I'd like to use this type and store the uuid it wraps, as the primary key.I have both
func (id *ID) Scan(src interface{}) error
andfunc (id ID) Value() (driver.Value, error)
implemented and they work for Find(), All(), etc... just not Create().Reasoning for the
ID
type that is wrapped with other fields is to use a graphql node interface to look up nodes of differing types across a federated schema. This reduces the number of queries that need to written by utilizing a singlenode(id: ID!): Node
query. So using just UUID, string, etc isn't really an option for me.Steps to Reproduce the Problem
ID
type that implements both Scan and Value. Making sure the Value function satisfies the tables pk typeID
type as the"db: id"
field in a modelExpected Behavior
I'd expexct Create() insert the value into the database using my
ID
type.Actual Behavior
I get an error: "can not use ID as a primary key type!"
Info
I'm using pop through buffalo. Right from my go.mod:
github.com/gobuffalo/pop/v5 v5.3.0
Related Buffalo pop code: https://github.com/gobuffalo/pop/blob/master/dialect_common.go#L45-L98
The text was updated successfully, but these errors were encountered: