Documentation ¶
Index ¶
- type ArticleService
- func (a *ArticleService) AddArticle(article *models.Article) bool
- func (a *ArticleService) GetArticle(id int) *models.Article
- func (a *ArticleService) GetArticles(PageNum int, PageSize int, total *uint64, where interface{}) []*models.Article
- func (a *ArticleService) GetTables(pageNum, pagesize int) []page.Article
- type IArticleService
- type IRoleService
- type IUserService
- type RoleService
- type UserService
- func (a *UserService) AddUser(user *models.User) bool
- func (a *UserService) CheckUser(username string, password string) bool
- func (a *UserService) DeleteUser(id int) bool
- func (a *UserService) ExistUserByName(username string) bool
- func (a *UserService) GetRoles(username string) []string
- func (a *UserService) GetUserAvatar(username string) *string
- func (a *UserService) GetUsers(page, pagesize int, maps interface{}) interface{}
- func (a *UserService) UpdateUser(modUser *models.User) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArticleService ¶
type ArticleService struct {
Repository repository.IArticleRepository `inject:""`
}
ArticleService 注入IArticleRepo
func (*ArticleService) AddArticle ¶
func (a *ArticleService) AddArticle(article *models.Article) bool
AddArticle 新增Article
func (*ArticleService) GetArticle ¶
func (a *ArticleService) GetArticle(id int) *models.Article
GetArticle 根据id获取Article
func (*ArticleService) GetArticles ¶
func (a *ArticleService) GetArticles(PageNum int, PageSize int, total *uint64, where interface{}) []*models.Article
GetArticles 获取文章信息
type IArticleService ¶
type IArticleService interface { //GetArticle 根据id获取Article GetArticle(id int) *models.Article //GetTables 分页返回文章 GetTables(pageNum, pagesize int) []page.Article //AddArticle 新增Article AddArticle(article *models.Article) bool //GetArticles 获取文章信息 GetArticles(PageNum int, PageSize int, total *uint64, where interface{}) []*models.Article }
IArticleService Article接口定义
type IRoleService ¶
type IRoleService interface { //GetUserRoles 分页返回Articles获取用户身份信息 GetUserRoles(userName string) []*models.Role }
IRoleService RoleService接口定义
type IUserService ¶
type IUserService interface { //CheckUser 身份验证 CheckUser(username string, password string) bool //GetUserAvatar 获取用户头像 GetUserAvatar(username string) *string //GetRoles 获取用户角色 GetRoles(username string) []string //GetUsers 获取用户信息 GetUsers(page, pagesize int, maps interface{}) interface{} //AddUser 新建用户 AddUser(user *models.User) bool //ExistUserByName 判断用户名是否已存在 ExistUserByName(username string) bool //UpdateUser 更新用户 UpdateUser(user *models.User) bool //DeleteUser 删除用户 DeleteUser(id int) bool }
IUserService UserService接口定义
type RoleService ¶
type RoleService struct {
Repository repository.IRoleRepository `inject:""`
}
RoleService IRoleRepository
func (*RoleService) GetUserRoles ¶
func (c *RoleService) GetUserRoles(userName string) []*models.Role
GetUserRoles 分页返回Articles获取用户身份信息
type UserService ¶
type UserService struct { Repository repository.IUserRepository `inject:""` RoleRepository repository.IRoleRepository `inject:""` Log logger.ILogger `inject:""` }
UserService 注入IUserRepository
func (*UserService) AddUser ¶
func (a *UserService) AddUser(user *models.User) bool
AddUser 新建用户,同时新建用户角色
func (*UserService) CheckUser ¶
func (a *UserService) CheckUser(username string, password string) bool
CheckUser 身份验证
func (*UserService) ExistUserByName ¶
func (a *UserService) ExistUserByName(username string) bool
ExistUserByName 判断用户名是否已存在
func (*UserService) GetRoles ¶
func (a *UserService) GetRoles(username string) []string
GetRoles 获取用户角色
func (*UserService) GetUserAvatar ¶
func (a *UserService) GetUserAvatar(username string) *string
GetUserAvatar 获取用户头像
func (*UserService) GetUsers ¶
func (a *UserService) GetUsers(page, pagesize int, maps interface{}) interface{}
GetUsers 获取用户信息
func (*UserService) UpdateUser ¶
func (a *UserService) UpdateUser(modUser *models.User) bool
UpdateUser 更新用户
Click to show internal directories.
Click to hide internal directories.