|
|
|
@ -15,7 +15,7 @@ var Slot = sl.NewSlot[Database]()
|
|
|
|
|
type Database interface {
|
|
|
|
|
// User
|
|
|
|
|
|
|
|
|
|
CreateUser(user model.User) error
|
|
|
|
|
CreateUser(user model.User) (db.Ref[model.User], error)
|
|
|
|
|
ReadUser(id db.Ref[model.User]) (model.User, error)
|
|
|
|
|
ReadUsers() ([]model.User, error)
|
|
|
|
|
UpdateUser(user model.User) error
|
|
|
|
@ -40,9 +40,9 @@ type Memory struct {
|
|
|
|
|
Users []model.User
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *Memory) CreateUser(user model.User) error {
|
|
|
|
|
func (m *Memory) CreateUser(user model.User) (db.Ref[model.User], error) {
|
|
|
|
|
m.Users = append(m.Users, user)
|
|
|
|
|
return nil
|
|
|
|
|
return db.Ref[model.User](user.Id), nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *Memory) ReadUser(id db.Ref[model.User]) (model.User, error) {
|
|
|
|
|