Skip to content

Update model using map with the generics api #7658

@eliaSchenker

Description

@eliaSchenker

Your Question

The documentation lists a way to update models using maps with the generics api: https://gorm.io/docs/update.html#Updates-multiple-columns
Even though it's explicitly described in the documentation, it seems that this isn't implemented, as can be seen here:

gorm/generics.go

Lines 61 to 63 in 6e7eb0a

Update(ctx context.Context, name string, value any) (rowsAffected int, err error)
Updates(ctx context.Context, t T) (rowsAffected int, err error)
Count(ctx context.Context, column string) (result int64, err error)

Was this mistakingly added to the documentation or is this missing from the implementation? Updating using maps with the generic api seems like a sensible feature.

The document you expected this should be explained

https://gorm.io/docs/update.html#Updates-multiple-columns

Expected answer

Generics api should offer a way to update using a map, like the traditional api.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions