mongop

package
v0.0.0-...-20ca37a Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: GPL-3.0 Imports: 7 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IdCursorType           = (*IdCursor)(nil)
	CreateAtDescCursorType = (*CreateAtDescCursor)(nil)
	CreateAtAscCursorType  = (*CreateAtAscCursor)(nil)
	UpdateAtDescCursorType = (*UpdateAtDescCursor)(nil)
	UpdateAtAscCursorType  = (*UpdateAtAscCursor)(nil)
	NameDescCursorType     = (*NameDescCursor)(nil)
	NameAscCursorType      = (*NameAscCursor)(nil)
	TypeDescCursorType     = (*TypeDescCursor)(nil)
	TypeAscCursorType      = (*TypeAscCursor)(nil)
)

Functions

This section is empty.

Types

type CreateAtAscCursor

type CreateAtAscCursor struct {
	ID string `json:"_id"`
}

func (*CreateAtAscCursor) MakeSortOptions

func (s *CreateAtAscCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

type CreateAtDescCursor

type CreateAtDescCursor struct {
	ID string `json:"_id"`
}

func (*CreateAtDescCursor) MakeSortOptions

func (s *CreateAtDescCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

降序

type IdCursor

type IdCursor struct {
	ID string `json:"_id"`
}

func (*IdCursor) MakeSortOptions

func (s *IdCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

type MongoCursor

type MongoCursor interface {
	MakeSortOptions(filter bson.M, backward bool) (bson.M, error)
}

type MongoPaginator

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

func NewMongoPaginator

func NewMongoPaginator(store pagination.Store, opts *pagination.PaginationOptions) *MongoPaginator

func (*MongoPaginator) MakeSortOptions

func (p *MongoPaginator) MakeSortOptions(ctx context.Context, filter bson.M) (bson.M, error)

MakeSortOptions 生成ID分页查询选项,并将filter在原地更新

func (*MongoPaginator) StoreCursor

func (p *MongoPaginator) StoreCursor(ctx context.Context, first, last any) error

func (*MongoPaginator) StoreStringCursor

func (p *MongoPaginator) StoreStringCursor(ctx context.Context, first, last any) error

func (*MongoPaginator) StoreTimeCursor

func (p *MongoPaginator) StoreTimeCursor(ctx context.Context, first, last any) error

type NameAscCursor

type NameAscCursor struct {
	Name string `json:"name"`
}

func (*NameAscCursor) MakeSortOptions

func (s *NameAscCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

type NameDescCursor

type NameDescCursor struct {
	Name string `json:"name"`
}

func (*NameDescCursor) MakeSortOptions

func (s *NameDescCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

type TypeAscCursor

type TypeAscCursor struct {
	Type string `json:"type"`
}

func (*TypeAscCursor) MakeSortOptions

func (s *TypeAscCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

type TypeDescCursor

type TypeDescCursor struct {
	Type string `json:"type"`
}

func (*TypeDescCursor) MakeSortOptions

func (s *TypeDescCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

type UpdateAtAscCursor

type UpdateAtAscCursor struct {
	UpdateAt time.Time `json:"updateAt"`
}

func (*UpdateAtAscCursor) MakeSortOptions

func (s *UpdateAtAscCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

type UpdateAtDescCursor

type UpdateAtDescCursor struct {
	UpdateAt time.Time `json:"updateAt"`
}

func (*UpdateAtDescCursor) MakeSortOptions

func (s *UpdateAtDescCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

Jump to

Keyboard shortcuts

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