1 Star 1 Fork 0

yanpin-dev / propeller

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
service.go 863 Bytes
一键复制 编辑 原始数据 按行查看 历史
zh_season 提交于 2021-03-31 15:30 . add update example.
package example
type Service interface {
Create(*User) error
Update(*User) error
Delete(uint64) error
FindByID(uint64) (*User, error)
FindAll() ([]*User, error)
UpdatePassword(string, string) error
}
func NewUserService(repo Repository) Service {
return &userService{repo: repo}
}
type userService struct {
repo Repository
}
func (s *userService) Create(user *User) error {
return s.repo.Create(user)
}
func (s *userService) Update(user *User) error {
return s.repo.Update(user)
}
func (s *userService) Delete(id uint64) error {
return s.repo.Delete(id)
}
func (s *userService) FindByID(id uint64) (*User, error) {
return s.repo.FindByID(id)
}
func (s *userService) FindAll() ([]*User, error) {
return s.repo.FindAll()
}
func (s *userService) UpdatePassword(username, password string) error {
return s.repo.UpdatePassword(username, password)
}
Go
1
https://gitee.com/yanpin-dev/propeller.git
git@gitee.com:yanpin-dev/propeller.git
yanpin-dev
propeller
propeller
v0.3.5

搜索帮助