adapter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGORMAdapter

func NewGORMAdapter(db *gorm.DB) paginator.Adapter

NewGORMAdapter gorm adapter constructor which receive the gorm db query.

func NewSliceAdapter

func NewSliceAdapter(source interface{}) paginator.Adapter

NewSliceAdapter slice adapter construct receive the slice source which needs to be paginated.

Types

type GORMAdapter

type GORMAdapter struct {
	// contains filtered or unexported fields
}

GORMAdapter gorm adapter to be passed to paginator constructor

func (*GORMAdapter) Nums

func (a *GORMAdapter) Nums() (int64, error)

Nums returns the number of records

func (*GORMAdapter) Slice

func (a *GORMAdapter) Slice(offset, length int, data interface{}) error

Slice stores into data argument a slice of the results. data must be a pointer to a slice of models.

type SliceAdapter

type SliceAdapter struct {
	// contains filtered or unexported fields
}

SliceAdapter slice adapter to be passed to paginator constructor to paginate a slice of elements.

func (*SliceAdapter) Nums

func (a *SliceAdapter) Nums() (int64, error)

Nums returns the number of elements

func (*SliceAdapter) Slice

func (a *SliceAdapter) Slice(offset, length int, dest interface{}) error

Slice stores into dest argument a slice of the results. dest argument must be a pointer to a slice

Jump to

Keyboard shortcuts

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