data

package
v5.0.0-...-03972fd Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoMatch         = errors.New("no match")
	ErrRangeCheckError = errors.New("range check error")
)
View Source
var Now = func() time.Time {
	return time.Now()
}

Current time. Override this function in the debug environment.

Functions

This section is empty.

Types

type ArrayProvider

type ArrayProvider struct {
	Quantity int // Items count
	Index    int // Current index (starts from 1)
	Loader   func(ctx context.Context) (int, error)
	// contains filtered or unexported fields
}

ArrayProvider is base for CustomArrayProvider

func (*ArrayProvider) Count

func (provider *ArrayProvider) Count(ctx context.Context) (int, error)

func (*ArrayProvider) Import

func (provider *ArrayProvider) Import(ctx context.Context, pagination *Pagination) error

func (*ArrayProvider) Next

func (provider *ArrayProvider) Next(ctx context.Context) error

func (*ArrayProvider) Total

func (provider *ArrayProvider) Total(ctx context.Context) (int, error)

type Pagination

type Pagination struct {
	Offset int64 `json:"offset"`
	Limit  int64 `json:"limit"`
}

type Provider

type Provider interface {
	// Get displayed records count
	Count(ctx context.Context) (int, error)
	// Get total records count
	Total(ctx context.Context) (int, error)
	// Import records
	Import(ctx context.Context, pagination *Pagination) error
	// Go to next row
	Next(ctx context.Context) error
}

Data provider for receive external data

type Sort

type Sort map[string]Sorting

type Sorting

type Sorting bool
const (
	SortAsc  Sorting = true
	SortDesc Sorting = false
)

Jump to

Keyboard shortcuts

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