cursor

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cursor

type Cursor struct {
	Fields   []Field `json:"fields"`
	Limit    int     `json:"limit"`
	Backward bool    `json:"backward"`

	DB *gorm.DB `json:"-"`
}

Cursor struct

func DecodeAction

func DecodeAction(sortingQuery, cursorQuery, afterQuery, beforeQuery string, defaultCursor *Cursor, model interface{}, limit uint) (cursor, additionalCursor *Cursor, err error)

func New

func New(limit int, fields ...Field) *Cursor

New Cursor

func (*Cursor) AddField

func (c *Cursor) AddField(name string, value interface{}, order common.DirectionType) *Cursor

AddField to cursor

func (*Cursor) Encode

func (c *Cursor) Encode() string

Encode Cursor to base64 string

func (*Cursor) GroupConditions

func (c *Cursor) GroupConditions(db *gorm.DB) *gorm.DB

GroupConditions for GORM v2

func (*Cursor) Scope

func (c *Cursor) Scope() func(db *gorm.DB) *gorm.DB

Scope convert Cursor to gorm.DB query

func (*Cursor) SetBackward added in v1.1.2

func (c *Cursor) SetBackward() *Cursor

func (*Cursor) ToCursor

func (c *Cursor) ToCursor(value interface{}) (cursor *Cursor)

type Field

type Field struct {
	Name      string               `json:"name"`
	Value     interface{}          `json:"value"`
	Direction common.DirectionType `json:"direction"`
}

Field struct

Jump to

Keyboard shortcuts

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