我想用 func 处理结构内部的结构:我的代码:
package models
type CalendarPushNotification struct {
Id string `db:"id"`
UserId string `db:"user_id"`
EventId string `db:"event_id"`
Title string `db:"title"`
StartDate string `db:"start_date"`
PushDate string `db:"push_date"`
PushDeliveryLineId string `db:"push_delivery_line_id"`
IsPushDelivered string `db:"is_push_delivered"`
}
type ResponseGetCalendar struct {
View struct {
EventId string `db:"event_id"`
Title string `db:"title"`
StartDate string `db:"start_date"`
PushDate string `db:"push_date"`
PushDeliveryLineId string `db:"push_delivery_line_id"`
IsPushDelivered string `db:"is_push_delivered"`
}`json:"schedules"`
}
var CalendarUtils = CalendarPushNotification{}
func (CalendarPushNotification) GetResponseGetCalendar(model *CalendarPushNotification) * ResponseGetCalendar {
return &ResponseGetCalendar{
EventId: model.EventId,
Title: model.Title,
StartDate: model.StartDate,
PushDate: model.PushDate,
PushDeliveryLineId: model.PushDeliveryLineId,
IsPushDelivered: model.IsPushDelivered,
}
}
返回 struct 时,我的 funcGetResponseGetCalendar看不到 struct 中的成员。ResponseGetCalendar struct
我错过了什么?
慕标5832272
ITMISS
BIG阳
相关分类