forked from xinliangnote/go-gin-api
/
service.go
42 lines (34 loc) · 1.48 KB
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package authorized
import (
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
"github.com/xinliangnote/go-gin-api/internal/repository/mysql"
"github.com/xinliangnote/go-gin-api/internal/repository/mysql/authorized"
"github.com/xinliangnote/go-gin-api/internal/repository/mysql/authorized_api"
"github.com/xinliangnote/go-gin-api/internal/repository/redis"
)
var _ Service = (*service)(nil)
type Service interface {
i()
Create(ctx core.Context, authorizedData *CreateAuthorizedData) (id int32, err error)
List(ctx core.Context, searchData *SearchData) (listData []*authorized.Authorized, err error)
PageList(ctx core.Context, searchData *SearchData) (listData []*authorized.Authorized, err error)
PageListCount(ctx core.Context, searchData *SearchData) (total int64, err error)
UpdateUsed(ctx core.Context, id int32, used int32) (err error)
Delete(ctx core.Context, id int32) (err error)
Detail(ctx core.Context, id int32) (info *authorized.Authorized, err error)
DetailByKey(ctx core.Context, key string) (data *CacheAuthorizedData, err error)
CreateAPI(ctx core.Context, authorizedAPIData *CreateAuthorizedAPIData) (id int32, err error)
ListAPI(ctx core.Context, searchAPIData *SearchAPIData) (listData []*authorized_api.AuthorizedApi, err error)
DeleteAPI(ctx core.Context, id int32) (err error)
}
type service struct {
db mysql.Repo
cache redis.Repo
}
func New(db mysql.Repo, cache redis.Repo) Service {
return &service{
db: db,
cache: cache,
}
}
func (s *service) i() {}