Update method tests

This commit is contained in:
Eden Kirin
2024-06-26 16:15:33 +02:00
parent 43824af97c
commit 8a81173fc8
2 changed files with 45 additions and 2 deletions

View File

@ -14,7 +14,7 @@ func (m *UpdateMethod[T]) Init(repo *RepoBase[T]) {
m.repo = repo
}
func (m UpdateMethod[T]) Update(filter interface{}, values map[string]interface{}) (int64, error) {
func (m UpdateMethod[T]) Update(filter interface{}, values map[string]any) (int64, error) {
var (
model T
)
@ -23,7 +23,7 @@ func (m UpdateMethod[T]) Update(filter interface{}, values map[string]interface{
if err != nil {
return 0, err
}
result := query.Updates(values)
result := query.Model(&model).Updates(values)
if result.Error != nil {
return 0, result.Error
}