service

package
v0.0.0-...-60b80de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

service

业务逻辑实现

  • 业务逻辑层,处于 controller 层和 model 层之间
  • service 只能通过 model 层获取数据
  • 如果有事务处理,在这一层进行处理
  • 如果是调用的第三方服务,请不要加 cache, 避免缓存不一致(对方更新数据,这边无法知晓)
  • 由于 service 会被 httprpc 调用,默认会提供 http 调用的,比如:GetUserInfo()
    • 如果 rpc 需要调用,可以对 GetUserInfo() 进行一层封装, 比如:GetUser()

Reference

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeletetUser

func DeletetUser(query map[string]interface{}) (*models.User, error)

DeletetUser ....

func SelectUser

func SelectUser(query map[string]interface{}) (*models.User, error)

SelectUser ....

Types

type UserLoginService

type UserLoginService struct {
	UserName string `form:"user_name" json:"user_name" binding:"required,min=5,max=30"`
	Password string `form:"password" json:"password" binding:"required,min=8,max=40"`
}

UserLoginService 管理用户登录的服务

func (*UserLoginService) Login

func (service *UserLoginService) Login(c *gin.Context) (string, error)

Login 用户登录函数

type UserRegisterService

type UserRegisterService struct {
	Nickname        string `form:"nickname" json:"nickname" binding:"required,min=2,max=30"`
	UserName        string `form:"user_name" json:"user_name" binding:"required,min=5,max=30"`
	Password        string `form:"password" json:"password" binding:"required,min=8,max=40"`
	PasswordConfirm string `form:"password_confirm" json:"password_confirm" binding:"required,min=8,max=40"`
}

UserRegisterService 管理用户注册服务

func (*UserRegisterService) Register

func (service *UserRegisterService) Register() error

Register 用户注册

type UserUpdateService

type UserUpdateService struct {
	Nickname string `form:"nickname" json:"nickname"`
	Password string `form:"password" json:"password"`
}

UserUpdateService 管理用户更新务

func (*UserUpdateService) UserUpdate

func (service *UserUpdateService) UserUpdate(query map[string]interface{}) (*models.User, error)

UserUpdate ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL