adapter

package
v0.0.0-...-eb89b7e Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GORMAdapter

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

GORMAdapter gorm adapter to be passed to paginator constructor

func NewGORMAdapter

func NewGORMAdapter(db *gorm.DB) GORMAdapter

NewGORMAdapter gorm adapter constructor which receive the gorm db query.

func (GORMAdapter) Nums

func (a GORMAdapter) Nums() int

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 MongoAdapter

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

MongoAdapter mongo adapter to be passed to paginator constructor

func NewMongoAdapter

func NewMongoAdapter(db *mongo.Collection) MongoAdapter

NewMongoAdapter Mongo adapter constructor which receive the Mongo db query.

func (MongoAdapter) Nums

func (a MongoAdapter) Nums() int

Nums returns the number of records

func (MongoAdapter) Slice

func (a MongoAdapter) 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 NewSliceAdapter

func NewSliceAdapter(source interface{}) SliceAdapter

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

func (SliceAdapter) Nums

func (a SliceAdapter) Nums() int

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