pagi

package
v0.0.0-...-e368738 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pagi provides utilities for implementing pagination in Go applications. It includes structures and methods for calculating page numbers, limits, and offsets based on total item counts and user-defined page sizes. This package aims to simplify the process of adding pagination to data-driven applications, ensuring efficient data retrieval and presentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RQL

func RQL[T any](query T, p *rql.Params, opts ...func(*sql.Selector)) T

Types

type Meta

type Meta struct {
	Limit  int `json:"limit"`
	Offset int `json:"offset"`
	Total  int `json:"total"`
}

type Param

type Param struct {
	Limit  int            `json:"limit"`
	Offset int            `json:"offset"`
	Filter map[string]any `json:"filter"`
	Sort   []string       `json:"sort"`
}

type Response

type Response[T any] struct {
	Data []T   `json:"data"`
	Meta *Meta `json:"meta"`
}

Jump to

Keyboard shortcuts

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