1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package model
- import (
- "time"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- )
- type SystemRole struct {
- Id int64 `json:"id,omitempty"`
- Name string `json:"name,omitempty"`
- Remarks string `json:"remarks,omitempty"`
- IsShow pasturePb.IsShow_Kind `json:"is_show,omitempty"`
- IsDelete pasturePb.IsShow_Kind `json:"is_delete,omitempty"`
- CreatedAt int64 `json:"created_at,omitempty"`
- UpdatedAt int64 `json:"updated_at,omitempty"`
- }
- func (s *SystemRole) TableName() string {
- return "system_role"
- }
- const (
- LayoutTime = "2006-01-02 15:04:05"
- LayoutDate = "20060102"
- LayoutDate2 = "2006-01-02"
- )
- type SystemRoleSlice []*SystemRole
- func (s SystemRoleSlice) ToPB() []*pasturePb.SearchRoleRequest {
- res := make([]*pasturePb.SearchRoleRequest, len(s))
- for i, v := range s {
- res[i] = &pasturePb.SearchRoleRequest{
- Id: int32(v.Id),
- Name: v.Name,
- Remarks: v.Remarks,
- IsShow: v.IsShow,
- CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
- UpdatedAtFormat: time.Unix(v.UpdatedAt, 0).Format(LayoutTime),
- }
- }
- return res
- }
|