lib

package
v2.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PartSizes = partSizes()

PartSizes return 10k parts that add up to 4.9 TB

View Source
var QueryEscape = url.QueryEscape

Functions

func Bool

func Bool(bool bool) *bool

func BuildPath

func BuildPath(resourcePath string, unescapedPath string) string

func CheckRequired

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

func CreateError

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

func ExportParams

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

func Interface

func Interface() interface{}

func NewReader

func NewReader(ctx context.Context, r io.Reader) io.Reader

NewReader gets a context-aware io.Reader.

func PathEscape

func PathEscape(path string) string

func String

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

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

func (ProgressWriter) Write

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

type Query

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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