We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have the following struct
type Identity struct { gormsupport.Lifecycle // Link to User UserID uuid.NullUUID `sql:"type:uuid"` User User }
and
identity := account.Identity{ User: user, UserID: uuid.NullUUID{UUID: uuid.NewV4(), Valid: true}, } err := s.identityRepo.Create(context.Background(), &identity)
and this is the Create method being called
Create
// Create creates a new record. func (m *GormIdentityRepository) Create(ctx context.Context, model *Identity) error { defer goa.MeasureSince([]string{"goa", "db", "identity", "create"}, time.Now()) if model.ID == uuid.Nil { model.ID = uuid.NewV4() } err := m.db.Create(model).Error if err != nil { log.Error(ctx, map[string]interface{}{ "identity_id": model.ID, "err": err, }, "unable to create the identity") return errs.WithStack(err) }
The line m.db.Create(model).Error is failing with cannot convert uuid.UUID to UUID
m.db.Create(model).Error
cannot convert uuid.UUID to UUID
The text was updated successfully, but these errors were encountered:
Any update on this issue?
Sorry, something went wrong.
How to solve this issue for now? I have seen this erros
type struct Me { ID uuid.UUID } ... if Me.ID != nil { // cannot convert untyped nil to uuid.UUID }
Happen even with uuid.NullUUID
uuid.NullUUID
I solve it using pointer so it could be a nil
nil
No branches or pull requests
I have the following struct
and
and this is the
Create
method being calledThe line
m.db.Create(model).Error
is failing withcannot convert uuid.UUID to UUID
The text was updated successfully, but these errors were encountered: