Fix typo
This commit is contained in:
@@ -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) {
|
func (r sqlRepository) put(id string, m interface{}) (newId string, err error) {
|
||||||
values, _ := toSqlArgs(m)
|
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"]
|
createdAt := values["created_at"]
|
||||||
delete(values, "created_at")
|
delete(values, "created_at")
|
||||||
if id != "" {
|
if id != "" {
|
||||||
@@ -172,13 +172,13 @@ func (r sqlRepository) put(id string, m interface{}) (newId string, err error) {
|
|||||||
return id, nil
|
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 == "" {
|
if id == "" {
|
||||||
rand, _ := uuid.NewRandom()
|
rand, _ := uuid.NewRandom()
|
||||||
id = rand.String()
|
id = rand.String()
|
||||||
values["id"] = id
|
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 {
|
if createdAt != nil {
|
||||||
values["created_at"] = createdAt
|
values["created_at"] = createdAt
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user