/
policy.go
52 lines (42 loc) · 1.48 KB
/
policy.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
43
44
45
46
47
48
49
50
51
52
package data
import (
"context"
"errors"
"github.com/Administration-LGL/miam-apiserver/internal/biz"
"github.com/go-kratos/kratos/v2/log"
)
type policyRepo struct {
data *Data
log *log.Helper
}
// NewGreeterRepo .
func NewPolicyRepo(data *Data, logger log.Logger) biz.PolicyRepo {
return &policyRepo{
data: data,
log: log.NewHelper(logger),
}
}
func (repo *policyRepo) Create(ctx context.Context, policy *biz.Policy, opts biz.CreateOptions) error {
// 实现具体的 Create 逻辑
return repo.data.db.Create(policy).Error
}
func (repo *policyRepo) Update(ctx context.Context, policy *biz.Policy, opts biz.UpdateOptions) error {
// 实现具体的 Update 逻辑
return errors.New("Not implemented")
}
func (repo *policyRepo) Delete(ctx context.Context, username string, name string, opts biz.DeleteOptions) error {
// 实现具体的 Delete 逻辑
return errors.New("Not implemented")
}
func (repo *policyRepo) DeleteCollection(ctx context.Context, username string, names []string, opts biz.DeleteOptions) error {
// 实现具体的 DeleteCollection 逻辑
return errors.New("Not implemented")
}
func (repo *policyRepo) Get(ctx context.Context, username string, name string, opts biz.GetOptions) (*biz.Policy, error) {
// 实现具体的 Get 逻辑
return nil, errors.New("Not implemented")
}
func (repo *policyRepo) List(ctx context.Context, username string, opts biz.ListOptions) (*biz.PolicyList, error) {
// 实现具体的 List 逻辑
return nil, errors.New("Not implemented")
}