package model import ( operationPb "kpt-tmr-group/proto/go/backend/operation" "time" ) type SystemMobile struct { Id int64 `json:"id,omitempty"` Name string `json:"name"` IsShow operationPb.IsShow_Kind `json:"is_show"` CreatedAt int64 `json:"created_at"` UpdatedAt int64 `json:"updated_at"` } func (s *SystemMobile) TableName() string { return "system_mobile" } type SystemMobileSlice []*SystemMobile func (s SystemMobileSlice) ToPB() []*operationPb.MobileData { res := make([]*operationPb.MobileData, len(s)) for i, v := range s { res[i] = &operationPb.MobileData{ Id: uint32(v.Id), Name: v.Name, CreatedAt: uint32(v.CreatedAt), CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime), } } return res }