service

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 1 Imported by: 0

README

service

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

Reference

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service struct

var (
	// Svc global service var
	Svc *Service
)

func New

func New() (s *Service)

New init service

func (*Service) Close

func (s *Service) Close()

Close service

func (*Service) Ping

func (s *Service) Ping() error

Ping service

func (*Service) UserSvc

func (s *Service) UserSvc() user.UserService

UserSvc return user service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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