Documentation ¶
Index ¶
- type IUserRepository
- type UserRepository
- func (u *UserRepository) CreateUser(user *model.User) (id int64, err error)
- func (u *UserRepository) DeleteUserById(id int64) error
- func (u *UserRepository) FindAll() ([]*model.User, error)
- func (u *UserRepository) FindUserById(id int64) (*model.User, error)
- func (u *UserRepository) FindUserByName(name string) (*model.User, error)
- func (u *UserRepository) InitTable() error
- func (u *UserRepository) UpdateUser(user *model.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IUserRepository ¶
type IUserRepository interface { // InitTable 初始化数据表 InitTable() error // FindUserByName 根据用户名称查找信息 FindUserByName(name string) (*model.User, error) // FindUserById 根据Id查找用户 FindUserById(id int64) (*model.User, error) // CreateUser 创建用户 CreateUser(user *model.User) (id int64, err error) // DeleteUserById 删除用户 DeleteUserById(id int64) error // UpdateUser 更新用户 UpdateUser(user *model.User) error // FindAll 查找所有用户 FindAll() ([]*model.User, error) }
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
func NewUserRepository ¶
func NewUserRepository(db *gorm.DB) *UserRepository
func (*UserRepository) CreateUser ¶
func (u *UserRepository) CreateUser(user *model.User) (id int64, err error)
func (*UserRepository) DeleteUserById ¶
func (u *UserRepository) DeleteUserById(id int64) error
func (*UserRepository) FindUserById ¶
func (u *UserRepository) FindUserById(id int64) (*model.User, error)
func (*UserRepository) FindUserByName ¶
func (u *UserRepository) FindUserByName(name string) (*model.User, error)
func (*UserRepository) InitTable ¶
func (u *UserRepository) InitTable() error
func (*UserRepository) UpdateUser ¶
func (u *UserRepository) UpdateUser(user *model.User) error
UpdateUser @Description: 更新用户纪录 @receiver u @param user *model.User @return error
Click to show internal directories.
Click to hide internal directories.