-
Notifications
You must be signed in to change notification settings - Fork 0
/
userprofile.go
60 lines (49 loc) · 1.41 KB
/
userprofile.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
53
54
55
56
57
58
59
60
package service
import (
"github.com/curltech/go-colla-biz/rbac/entity"
"github.com/curltech/go-colla-core/container"
"github.com/curltech/go-colla-core/service"
"github.com/curltech/go-colla-core/util/message"
)
/**
同步表结构,服务继承基本服务的方法
*/
type UserProfileService struct {
service.OrmBaseService
}
var userProfileService = &UserProfileService{}
func GetUserProfileService() *UserProfileService {
return userProfileService
}
func (this *UserProfileService) GetSeqName() string {
return seqname
}
func (this *UserProfileService) NewEntity(data []byte) (interface{}, error) {
entity := &entity.UserProfile{}
if data == nil {
return entity, nil
}
err := message.Unmarshal(data, entity)
if err != nil {
return nil, err
}
return entity, err
}
func (this *UserProfileService) NewEntities(data []byte) (interface{}, error) {
entities := make([]*entity.UserProfile, 0)
if data == nil {
return &entities, nil
}
err := message.Unmarshal(data, &entities)
if err != nil {
return nil, err
}
return &entities, err
}
func init() {
service.GetSession().Sync(new(entity.UserProfile))
userProfileService.OrmBaseService.GetSeqName = userProfileService.GetSeqName
userProfileService.OrmBaseService.FactNewEntity = userProfileService.NewEntity
userProfileService.OrmBaseService.FactNewEntities = userProfileService.NewEntities
container.RegistService("userProfile", userProfileService)
}