updated base model comments
This commit is contained in:
+2
-3
@@ -44,7 +44,7 @@ type BaseModel struct {
|
|||||||
Updated types.DateTime `db:"updated" json:"updated"`
|
Updated types.DateTime `db:"updated" json:"updated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasId returns whether the model has a nonzero primary key (aka. id).
|
// HasId returns whether the model has a nonzero id.
|
||||||
func (m *BaseModel) HasId() bool {
|
func (m *BaseModel) HasId() bool {
|
||||||
return m.GetId() != ""
|
return m.GetId() != ""
|
||||||
}
|
}
|
||||||
@@ -66,8 +66,7 @@ func (m *BaseModel) GetUpdated() types.DateTime {
|
|||||||
|
|
||||||
// RefreshId generates and sets a new model id.
|
// RefreshId generates and sets a new model id.
|
||||||
//
|
//
|
||||||
// The generated id is a cryptographically random 15 characters length string
|
// The generated id is a cryptographically random 15 characters length string.
|
||||||
// (could change in the future).
|
|
||||||
func (m *BaseModel) RefreshId() {
|
func (m *BaseModel) RefreshId() {
|
||||||
m.Id = security.RandomString(15)
|
m.Id = security.RandomString(15)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user