utils

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPaginationFields = errors.New("invalid pagination fields")
	ErrInvalidFirstPage        error
	ErrInvalidPerPage          = errors.New("per page value should be bigger than 1")
	FirstPage                  = 1
)

Functions

func MerkleHashFunc

func MerkleHashFunc(data []byte) ([]byte, error)

func Uint16ToBytes

func Uint16ToBytes(x uint16) []byte

Types

type Bitset

type Bitset []bool

func BitsetFromBytes

func BitsetFromBytes(b []byte) Bitset

func (*Bitset) GetBit

func (b *Bitset) GetBit(i int) bool

func (*Bitset) Len

func (b *Bitset) Len() int

func (*Bitset) SetBit

func (b *Bitset) SetBit(i int, value bool)

func (*Bitset) ToBytes

func (b *Bitset) ToBytes() []byte

type Pagination

type Pagination struct {
	Meta metaPagination `json:"meta"`
}

func NewPagination

func NewPagination(currentPage, perPage, total int) Pagination

type PaginationQuery

type PaginationQuery struct {
	Page    int `form:"page" json:"page"`
	PerPage int `form:"per_page" json:"per_page"`
}

func NewPaginationQuery

func NewPaginationQuery(ctx *gin.Context) (PaginationQuery, error)

func (PaginationQuery) Skip

func (p PaginationQuery) Skip() int

Jump to

Keyboard shortcuts

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