data

package
v0.0.0-...-f42576b Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasePaginateable

type BasePaginateable struct {
	ID        xid.ID
	CreatedAt time.Time
	UpdatedAt time.Time
}

BasePaginateable provides common functionalities around paginateable objects

func (*BasePaginateable) GetCursor

func (paginateable *BasePaginateable) GetCursor() (cursor *Cursor, err error)

GetCursor returns the cursor value for this producer

func (*BasePaginateable) GetLastUpdatedHTTPTimeString

func (paginateable *BasePaginateable) GetLastUpdatedHTTPTimeString() string

GetLastUpdatedHTTPTimeString exposes the string rep of the last modified timestamp for the object

func (*BasePaginateable) QuickFix

func (paginateable *BasePaginateable) QuickFix() bool

QuickFix fixes base paginate-able model's attribute

type Cursor

type Cursor struct {
	ID        string
	Timestamp time.Time
}

Cursor represents a string used for pagination

func ParseCursor

func ParseCursor(encodedCursorString string) (cursor *Cursor, err error)

ParseCursor creates Cursor from its string representation

func (*Cursor) String

func (c *Cursor) String() string

type Paginateable

type Paginateable interface {
	GetCursor() (*Cursor, error)
}

Paginateable should be implemented by objects having xid.ID as field ID in DB and helps get cursor object

type Pagination

type Pagination struct {
	Next     *Cursor
	Previous *Cursor
}

Pagination represents a data structure to determine how to traverse a list

func NewPagination

func NewPagination(after Paginateable, before Paginateable) *Pagination

NewPagination returns a new pagination wrapper

type ValidateableModel

type ValidateableModel interface {
	QuickFix() bool
	IsInValidState() bool
}

ValidateableModel model supporting this can be checked for valid state before write ops. Also allows for quick fix to be applied

Jump to

Keyboard shortcuts

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