123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- //go:generate reform
- //go:generate easyjson -all pass.go
- package models
- //reform:events_users_view
- type Pass struct {
- Id int `reform:"UserId"`
- Firstname string `reform:"Firstname"`
- Lastname string `reform:"Lastname"`
- Patronymic *string `reform:"Patronymic"`
- PhotoId int `reform:"PhotoID"`
- PersonId *int `reform:"person_id"`
- EmpGUID *int `reform:"EmpGUID"`
- //IsActual bool `reform:"is_actual"`
- }
- func (pass *Pass) AfterFind() error {
- return nil
- }
- func (pass Pass) PatronymicSafe() string {
- if pass.Patronymic == nil {
- return ""
- }
- return *pass.Patronymic
- }
- func (pass Pass) FixOkRow() *FixOkRow {
- var empGUID int
- if pass.EmpGUID == nil {
- empGUID = 0
- } else {
- empGUID = *pass.EmpGUID
- }
- return &FixOkRow{
- Id: pass.Id,
- EmpGUID: empGUID,
- }
- }
- type Passes []Pass
- func (passes Passes) ToMap() map[int]*Pass {
- passMap := map[int]*Pass{}
- for idx, pass := range passes {
- passMap[pass.Id] = &passes[idx]
- }
- return passMap
- }
|