From 677c7faffe773e1e2135ec944539365fdb009177 Mon Sep 17 00:00:00 2001 From: TwinProduction Date: Wed, 14 Jul 2021 22:25:34 -0400 Subject: [PATCH] Start working on paging implementation --- storage/store/paging/paging.go | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 storage/store/paging/paging.go diff --git a/storage/store/paging/paging.go b/storage/store/paging/paging.go new file mode 100644 index 00000000..7a9c9583 --- /dev/null +++ b/storage/store/paging/paging.go @@ -0,0 +1,35 @@ +package paging + +// ServiceStatusParams represents all parameters that can be used for paging purposes +type ServiceStatusParams struct { + EventsPage int // Number of the event page + EventsPageSize int // Size of the event page + ResultsPage int // Number of the result page + ResultsPageSize int // Size of the result page + IncludeUptime bool // Whether to include uptime data +} + +// NewServiceStatusParams creates a new ServiceStatusParams +func NewServiceStatusParams() *ServiceStatusParams { + return &ServiceStatusParams{} +} + +// WithEvents sets the values for EventsPage and EventsPageSize +func (params *ServiceStatusParams) WithEvents(page, pageSize int) *ServiceStatusParams { + params.EventsPage = page + params.EventsPageSize = pageSize + return params +} + +// WithResults sets the values for ResultsPage and ResultsPageSize +func (params *ServiceStatusParams) WithResults(page, pageSize int) *ServiceStatusParams { + params.ResultsPage = page + params.ResultsPageSize = pageSize + return params +} + +// WithUptime sets the value IncludeUptime to true +func (params *ServiceStatusParams) WithUptime() *ServiceStatusParams { + params.IncludeUptime = true + return params +}