This commit is contained in:
Deluan 2020-05-08 18:29:30 -04:00 committed by Deluan Quintão
parent 5afcd0ad22
commit 27de18f8c9
1 changed files with 3 additions and 3 deletions

View File

@ -159,7 +159,7 @@ func (r sqlRepository) count(countQuery SelectBuilder, options ...model.QueryOpt
func (r sqlRepository) put(id string, m interface{}) (newId string, err error) {
values, _ := toSqlArgs(m)
// Remove created_at from args and save it for later, if needed fo insert
// Remove created_at from args and save it for later, if needed for insert
createdAt := values["created_at"]
delete(values, "created_at")
if id != "" {
@ -172,13 +172,13 @@ func (r sqlRepository) put(id string, m interface{}) (newId string, err error) {
return id, nil
}
}
// if does not have an id OR could not update (new record with predefined id)
// If does not have an id OR could not update (new record with predefined id)
if id == "" {
rand, _ := uuid.NewRandom()
id = rand.String()
values["id"] = id
}
// It is a insert, if there was a created_at, add it back to args
// It is a insert. if there was a created_at, add it back to args
if createdAt != nil {
values["created_at"] = createdAt
}