// LoadPage populates action.Page func (action *TransactionIndexAction) LoadPage() { for _, record := range action.Records { var res resource.Transaction 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 *TransactionIndexAction) SSE(stream sse.Stream) { action.Do( action.LoadQuery, action.LoadRecords, func() { stream.SetLimit(int(action.Query.Limit)) records := action.Records[stream.SentCount():] for _, record := range records { var res resource.Transaction res.Populate(action.Ctx, record) stream.Send(sse.Event{ID: res.PagingToken(), Data: res}) } }, ) }