From 7dbde463ea5b34b2b2a1d64ed5f0a9963625c06f Mon Sep 17 00:00:00 2001 From: DinoLai Date: Wed, 15 Nov 2017 23:48:50 +0800 Subject: [PATCH] fix typo in models.md --- documents/models.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documents/models.md b/documents/models.md index d3a0807a..d316d951 100644 --- a/documents/models.md +++ b/documents/models.md @@ -42,7 +42,7 @@ type Address struct { type Language struct { ID int Name string `gorm:"index:idx_name_code"` // Create index with name, and will create combined index if find other fields defined same name - Code string `gorm:"index:idx_name_code"` // `unique_index` also works + Code string `gorm:"unique_index:idx_name_code"` // `unique_index` also works } type CreditCard struct { @@ -165,7 +165,7 @@ Save records having `UpdatedAt` field will set it to current time. ```go // Whenever one or more `user` fields are edited using Save() or Update(), `UpdatedAt` will be set to current time db.Save(&user) // will set `UpdatedAt` to current time -db.Model(&user).Update("name", "jinzhu") // will set `UpdatedAt` to current time +db.Model(&user).Update("name", "jinzhu") // will set `UpdatedAt` to current time ``` ### Use `DeletedAt` to store record's deleted time if field exists