Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AdminService = newAdminService()
View Source
var ArticleService = newArticleService()
View Source
var CommentArchiveService = newCommentArchiveService()
View Source
var CommentService = newCommentService()
View Source
var LoginHistoryService = newLoginHistoryService()
View Source
var PaymentHistoryService = newPaymentHistoryService()
View Source
var RecommendService = newRecommendService()
View Source
var RoleService = newRoleService()
View Source
var ScoreHistoryService = newScoreHistoryService()
View Source
var UserService = NewUserService(repositories.NewUserRepository())
View Source
var UserTokenService = NewUserTokenService(repositories.NewUserTokenRepository())
Functions ¶
func NewUserService ¶
func NewUserService(repo repositories.UserRepository) *userServiceImpl
NewUserService返回默认用户服务
Types ¶
type UserServiceInterface ¶
type UserServiceInterface interface { GetAll() []models.User GetByID(id int64) models.User GetByUsernameAndPassword(username, userPassword string) (models.User, bool) DeleteByID(id int64) bool Update(id int64, user models.User) (models.User, error) UpdatePassword(id int64, newPassword string) (models.User, error) UpdateUsername(id int64, newUsername string) (models.User, error) Create(userPassword string, user models.User) (models.User, error) }
UserService处理用户数据模型的CRUID操作, 它取决于用户存储库的操作。 这是将数据源与更高级别的组件分离。 因此,不同的存储库类型可以使用相同的逻辑,而无需任何更改。 它是一个接口,它在任何地方都被用作接口 因为我们可能需要在将来更改或尝试实验性的不同域逻辑。
type UserTokenServiceImpl ¶
type UserTokenServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserTokenService ¶
func NewUserTokenService(repo repositories.UserTokenRepository) *UserTokenServiceImpl
NewUserTokenService返回默认用户服务
func (*UserTokenServiceImpl) DeleteByID ¶
func (s *UserTokenServiceImpl) DeleteByID(id int64) bool
DeleteByID按其id删除用户。 如果删除则返回true,否则返回false。
func (*UserTokenServiceImpl) GetByID ¶
func (s *UserTokenServiceImpl) GetByID(id int64) *models.UserToken
func (*UserTokenServiceImpl) UpdateToken ¶
func (s *UserTokenServiceImpl) UpdateToken(id int64) string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.