Fixed a bug where a struct would have old values in it
This commit is contained in:
@ -7,8 +7,4 @@ type CRUDable interface {
|
||||
ReadAll(*User) (interface{}, error)
|
||||
Update(int64) error
|
||||
Delete(int64) error
|
||||
|
||||
// This method is needed, because old values would otherwise remain in the struct.
|
||||
// TODO find a way of not needing an extra function
|
||||
Empty()
|
||||
}
|
||||
|
@ -84,15 +84,3 @@ func GetAllTeamsByNamespaceID(id int64) (teams []*Team, err error) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Empty empties a struct. Because we heavily use pointers, the old values remain in the struct.
|
||||
// If you then update by not providing evrything, you have i.e. the old description still in the
|
||||
// newly created team, but you didn't provided one.
|
||||
func (t *Team) Empty() {
|
||||
t.ID = 0
|
||||
t.CreatedByID = 0
|
||||
t.CreatedBy = &User{}
|
||||
t.Name = ""
|
||||
t.Description = ""
|
||||
t.Members = []*User{}
|
||||
}
|
||||
|
Reference in New Issue
Block a user