lib

package
v1.2.1218 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 8 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QueryEscape = url.QueryEscape

Functions

func Bool

func Bool(bool bool) *bool

func BuildPath added in v1.0.107

func BuildPath(resourcePath string, unescapedPath string) string

func CheckRequired added in v1.0.16

func CheckRequired(iStruct interface{}, values *url.Values) error

func CreateError added in v1.0.16

func CreateError(i interface{}, name string) error

func ExportParams

func ExportParams(i interface{}) (url.Values, error)

func Interface

func Interface() interface{}

func PathEscape added in v1.0.78

func PathEscape(path string) string

func String added in v1.0.78

func String(string string) *string

Types

type Iter

type Iter struct {
	Query
	ListParams   ListParamsContainer
	Params       []interface{}
	CurrentIndex int
	Values       *[]interface{}
	Cursor       string
	Error        error
}

func (*Iter) Current

func (i *Iter) Current() interface{}

func (*Iter) EOFPage

func (i *Iter) EOFPage() bool

func (*Iter) Err

func (i *Iter) Err() error

Err returns the error, if any, that caused the Iter to stop. It must be inspected after Next returns false.

func (*Iter) ExportParams

func (i *Iter) ExportParams() (url.Values, error)

func (*Iter) GetCursor

func (i *Iter) GetCursor() string

func (*Iter) GetPage

func (i *Iter) GetPage() bool

func (*Iter) GetParams

func (i *Iter) GetParams() *ListParams

func (*Iter) Next

func (i *Iter) Next() bool

Next iterates the results in i.Current() or i.`ResourceName`(). It returns true until there are no results remaining. To adjust the number of results set ListParams.PerPage. To have it auto-paginate set ListParams.MaxPages, default is 1.

To iterate over all results use the following pattern.

for i.Next() {
  i.Current()
}

func (*Iter) SetCursor

func (i *Iter) SetCursor(cursor string)

type ListParams

type ListParams struct {
	Page     int64  `json:"page,omitempty" url:"page,omitempty" required:"false"`
	PerPage  int64  `json:"per_page,omitempty" url:"per_page,omitempty" required:"false"`
	Cursor   string `json:"cursor,omitempty" url:"cursor,omitempty" required:"false"`
	MaxPages int64  `json:"-" url:"-"`
}

func (*ListParams) GetListParams

func (p *ListParams) GetListParams() *ListParams

GetListParams returns a ListParams struct (itself). It exists because any structs that embed ListParams will inherit it, and thus implement the ListParamsContainer interface.

func (*ListParams) Set

func (p *ListParams) Set(page int64, perPage int64, cursor string, maxPages int64)

type ListParamsContainer

type ListParamsContainer interface {
	GetListParams() *ListParams
}

ListParamsContainer is a general interface for which all list parameter structs should comply. They achieve this by embedding a ListParams struct and inheriting its implementation of this interface.

type ProgressWriter added in v1.0.107

type ProgressWriter struct {
	Writer          io.Writer
	ProgressWatcher func(int64)
}

func (ProgressWriter) Write added in v1.0.107

func (w ProgressWriter) Write(p []byte) (n int, err error)

type Query

type Query func() (*[]interface{}, string, error)

Jump to

Keyboard shortcuts

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