pagination

package
v2.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterItems

func FilterItems[T any](items []T, filter string, filterFunc func(T, *Filter) bool) ([]T, error)

func MatchSubstring

func MatchSubstring(target *string, substring string) bool

MatchSubstring checks if the target string contains the substring.

func OrderItems

func OrderItems[T any](items []T, orderBy string, orderFunc func(T, T, *OrderBy) bool) ([]T, error)

func PaginateItems

func PaginateItems[T any](items []T, pageSize, offset int) (*[]T, error)

func ValidateParams

func ValidateParams(params any) (pageSize, offset *int, orderBy, filter *string, err error)

ValidateParams validates the incoming parameters for pagination

Types

type Filter

type Filter struct {
	Name  string
	Value string
}

type OrderBy

type OrderBy struct {
	Name   string
	IsDesc bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL