utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 6 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 IsSHA256 added in v1.3.2

func IsSHA256(record string) bool

func MerkleHashFunc

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

func Uint16ToBytes

func Uint16ToBytes(x uint16) []byte

Types

type BitsetBool added in v1.3.2

type BitsetBool []bool

func BitsetBoolFromBytes added in v1.3.2

func BitsetBoolFromBytes(b []byte) BitsetBool

func (*BitsetBool) GetBit added in v1.3.2

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

func (*BitsetBool) Len added in v1.3.2

func (b *BitsetBool) Len() int

func (*BitsetBool) SetBit added in v1.3.2

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

func (*BitsetBool) ToBytes added in v1.3.2

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

type BitsetInt added in v1.3.2

type BitsetInt []int

func BitsetIntFromString added in v1.3.2

func BitsetIntFromString(input string) (BitsetInt, error)

func (BitsetInt) ToString added in v1.3.2

func (b BitsetInt) ToString() (string, error)

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