push_app_info_repository.go
1.2 KB
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
package repository
import (
"github.com/astaxie/beego/orm"
"openapi/pkg/domain"
"openapi/pkg/infrastructure/bgorm/model"
)
type AppInfoRepository struct {
}
func (repository *AppInfoRepository) FindOne(queryOptions map[string]interface{}) (*domain.AppInfo, error) {
o := orm.NewOrm()
model := new(models.PushAppInfo)
qs := o.QueryTable(model).Filter("project_key", queryOptions["project_key"])
err := qs.One(model)
if err != nil {
return nil, err
}
return repository.transformBgormModelToDomainModel(model)
}
func (repository *AppInfoRepository) Find(queryOptions map[string]interface{}) (rsp []*domain.AppInfo, err error) {
return
}
func (repository *AppInfoRepository) transformBgormModelToDomainModel(model *models.PushAppInfo) (*domain.AppInfo, error) {
return &domain.AppInfo{
Id: model.Id,
AppKey: model.AppKey,
AppMasterSecret: model.AppMasterSecret,
AppId: model.AppId,
ProjectName: model.ProjectName,
ProjectKey: model.ProjectKey,
}, nil
}
func NewAppInfoRepository(transactionContext interface{}) (*AppInfoRepository, error) {
if transactionContext == nil {
return &AppInfoRepository{}, nil
} else {
return &AppInfoRepository{}, nil
}
}