Documentation ¶
Index ¶
- Variables
- func Decode(cursor string) []interface{}
- func Encode(v reflect.Value, keys []string) string
- type Cursor
- type CursorDecoder
- type CursorEncoder
- type Order
- type Paginator
- func (p *Paginator) GetNextCursor() Cursor
- func (p *Paginator) Paginate(stmt *gorm.DB, out interface{}) *gorm.DB
- func (p *Paginator) SetAfterCursor(afterCursor string)
- func (p *Paginator) SetBeforeCursor(beforeCursor string)
- func (p *Paginator) SetKeys(keys ...string)
- func (p *Paginator) SetLimit(limit int)
- func (p *Paginator) SetOrder(order Order)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidDecodeReference = errors.New("decode reference should be struct") ErrInvalidField = errors.New("invalid field") ErrInvalidOldField = errors.New("invalid old field") )
Errors for decoders
Functions ¶
Types ¶
type Cursor ¶ added in v1.3.1
type Cursor struct { After *string `json:"after" query:"after"` Before *string `json:"before" query:"before"` }
Cursor cursor data
type CursorDecoder ¶ added in v1.3.1
type CursorDecoder interface {
Decode(cursor string) []interface{}
}
CursorDecoder decoder for cursor
func NewCursorDecoder ¶ added in v1.3.1
func NewCursorDecoder(ref interface{}, keys ...string) (CursorDecoder, error)
NewCursorDecoder creates cursor decoder
type CursorEncoder ¶ added in v1.3.1
type CursorEncoder interface {
Encode(v interface{}) string
}
CursorEncoder encoder for cursor
func NewCursorEncoder ¶ added in v1.3.1
func NewCursorEncoder(keys ...string) CursorEncoder
NewCursorEncoder creates cursor encoder
type Paginator ¶
type Paginator struct {
// contains filtered or unexported fields
}
Paginator a builder doing pagination
func (*Paginator) GetNextCursor ¶ added in v1.3.1
GetNextCursor returns cursor for next pagination
func (*Paginator) SetAfterCursor ¶
SetAfterCursor sets paging after cursor
func (*Paginator) SetBeforeCursor ¶
SetBeforeCursor sets paging before cursor
Source Files ¶
Click to show internal directories.
Click to hide internal directories.