Просмотр исходного кода

Add JSON tag to person and PersonId. Change DateOfBirth field to pointer value

Rufus Deponian лет назад: 5
Родитель
Сommit
1b78fb384b
2 измененных файлов с 14 добавлено и 14 удалено
  1. 4 4
      api11/person.go
  2. 10 10
      api11/personId.go

+ 4 - 4
api11/person.go

@@ -8,10 +8,10 @@ import (
 //reform:person_cache
 type Person struct {
 	PersonId    `reform:",embedded:embedded,file:personId.go"`
-	Fullname    string      `reform:"fullname"      view:"readonly"`
-	Description string      `reform:"description"   view:"readonly"`
-	DateOfBirth extime.Date `reform:"date_of_birth" view:"readonly"`
-	IsActive    bool        `reform:"is_active"     view:"readonly"`
+	Fullname    string       `reform:"fullname"      json:"fullname"      view:"readonly"`
+	Description string       `reform:"description"   json:"description"   view:"readonly"`
+	DateOfBirth *extime.Date `reform:"date_of_birth" json:"date_of_birth" view:"readonly"`
+	IsActive    bool         `reform:"is_active"     json:"is_active"     view:"readonly"`
 }
 
 type People []Person

+ 10 - 10
api11/personId.go

@@ -9,16 +9,16 @@ type StudentStatus int
 
 //reform:person_ids
 type PersonId struct {
-	Id             int             `reform:"id"               view:"readonly"`
-	EmpGUID        *int            `reform:"EmpGUID"          view:"readonly"`
-	StaffId        *int            `reform:"staff_id"         view:"readonly"`
-	StaffStatus    *StaffStatus    `reform:"staff_status"     view:"readonly"`
-	StudentIds     []int           `reform:"student_ids"      view:"readonly"`
-	StudentStatus  []StudentStatus `reform:"student_status"   view:"readonly"`
-	LearndepIds    []int           `reform:"learndep_ids"     view:"readonly"`
-	RecordBookNums []int           `reform:"record_book_nums" view:"readonly"`
-	PhysGuardIds   []int           `reform:"phys_guard_ids"   view:"readonly"`
-	Logins         []string        `reform:"logins"           view:"readonly"`
+	Id             int             `reform:"id"               json:"id"               view:"readonly"`
+	EmpGUID        *int            `reform:"EmpGUID"          json:"EmpGUID"          view:"readonly"`
+	StaffId        *int            `reform:"staff_id"         json:"staff_id"         view:"readonly"`
+	StaffStatus    *StaffStatus    `reform:"staff_status"     json:"staff_status"     view:"readonly"`
+	StudentIds     []int           `reform:"student_ids"      json:"student_ids"      view:"readonly"`
+	StudentStatus  []StudentStatus `reform:"student_status"   json:"student_status"   view:"readonly"`
+	LearndepIds    []int           `reform:"learndep_ids"     json:"learndep_ids"     view:"readonly"`
+	RecordBookNums []int           `reform:"record_book_nums" json:"record_book_nums" view:"readonly"`
+	PhysGuardIds   []int           `reform:"phys_guard_ids"   json:"phys_guard_ids"   view:"readonly"`
+	Logins         []string        `reform:"logins"           json:"logins"           view:"readonly"`
 
 	person *Person
 }