// LoadPage populates action.Page func (action *OffersByAccountAction) LoadPage() { for _, record := range action.Records { var res resource.Offer res.Populate(action.Ctx, record) action.Page.Add(res) } action.Page.BaseURL = action.BaseURL() action.Page.BasePath = action.Path() action.Page.Limit = action.Query.Limit action.Page.Cursor = action.Query.Cursor action.Page.Order = action.Query.Order action.Page.PopulateLinks() }
// SSE is a method for actions.SSE func (action *OffersByAccountAction) SSE(stream sse.Stream) { action.Do( action.LoadQuery, action.LoadRecords, func() { stream.SetLimit(int(action.Query.Limit)) for _, record := range action.Records[stream.SentCount():] { var res resource.Offer res.Populate(action.Ctx, record) stream.Send(sse.Event{ID: res.PagingToken(), Data: res}) } }, ) }