forked from IceWhaleTech/CasaOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rely.go
40 lines (31 loc) · 812 Bytes
/
rely.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
package service
import (
loger2 "github.com/IceWhaleTech/CasaOS/pkg/utils/loger"
model2 "github.com/IceWhaleTech/CasaOS/service/model"
"gorm.io/gorm"
)
type RelyService interface {
Create(rely model2.RelyDBModel)
Delete(id string)
GetInfo(id string) model2.RelyDBModel
}
type relyService struct {
db *gorm.DB
log loger2.OLog
}
func (r *relyService) Create(rely model2.RelyDBModel) {
r.db.Create(&rely)
}
//获取我的应用列表
func (r *relyService) GetInfo(id string) model2.RelyDBModel {
var m model2.RelyDBModel
r.db.Where("custom_id = ?", id).First(&m)
return m
}
func (r *relyService) Delete(id string) {
var c model2.RelyDBModel
r.db.Where("custom_id = ?", id).Delete(&c)
}
func NewRelyService(db *gorm.DB, log loger2.OLog) RelyService {
return &relyService{db: db, log: log}
}