option

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: Apache-2.0 Imports: 11 Imported by: 54

Documentation

Overview

Package option define storage options

Index

Constants

View Source
const (
	//ErrorTypeDownload download error type
	ErrorTypeDownload = "download"
	//ErrorTypeUpload upload error type
	ErrorTypeUpload = "upload"
	//ErrorTypeReader reader error type
	ErrorTypeReader = "reader"
)
View Source
const (
	//NoCacheBaseURL no cache base URL
	NoCacheBaseURL = iota + 1
)

Variables

This section is empty.

Functions

func Append

func Append(options []storage.Option, newOptions ...storage.Option) []storage.Option

Append storage options

func Assign

func Assign(options []storage.Option, supported ...interface{}) ([]storage.Option, bool)

Assign assign supplied option, if returns un assign options and true if assign at least one

Types

type AES256Key

type AES256Key struct {
	Key                 []byte
	Base64Key           string
	Base64KeyMd5Hash    string
	Base64KeySha256Hash string
}

AES256Key represents custom key

func NewAES256Key

func NewAES256Key(key []byte) (result *AES256Key, err error)

NewAES256Key returns new key

func NewBase64AES256Key

func NewBase64AES256Key(base64Key string) (result *AES256Key, err error)

NewBase64AES256Key create a AES256Key from base64 encoded key

func (*AES256Key) Init

func (k *AES256Key) Init() (err error)

Init initialises key

func (*AES256Key) Validate

func (k *AES256Key) Validate() error

Validate checks if key is valid

type BasicAuth

type BasicAuth interface {
	Credentials() (user, password string)
}

BasicAuth represents a basic auth

func NewBasicAuth

func NewBasicAuth(user, password string) BasicAuth

NewBasicAuth returns credential authenticator

type Crc

type Crc struct {
	Hash uint32
}

Crc represents crc hash

func NewCrc

func NewCrc(data []byte) *Crc

NewCrc returns a crc hash for supplied data

func (*Crc) Decode

func (c *Crc) Decode(encoded string) error

Decode decodes base64 encoded hash

func (*Crc) Encode

func (c *Crc) Encode() string

Encode encodes hash

type Dest

type Dest storage.Options

Dest represents dest options

func NewDest

func NewDest(options ...storage.Option) *Dest

NewDest returns new source options

type Error

type Error struct {
	Type  string
	Error error
}

Error represents a simulation error

func NewDownloadError

func NewDownloadError(err error) *Error

NewDownloadError creates a download error

func NewErrors

func NewErrors(errors ...*Error) []*Error

NewErrors creates an error slice for supplied errors

func NewReaderError

func NewReaderError(err error) *Error

NewReaderError creates a reader error

func NewUploadError

func NewUploadError(err error) *Error

NewUploadError creates an upload error

type Errors

type Errors []*Error

Errors represents simulation errors

type Location

type Location struct {
	Path string
}

Location represents a location

func NewLocation

func NewLocation(path string) *Location

NewLocation create a location with supplied path

type Matcher

type Matcher func(parent string, info os.FileInfo) bool

Matcher represents a matcher

func GetMatcher

func GetMatcher(matcher Matcher) Matcher

GetMatcher returns supplied matcher or default matcher

type Md5

type Md5 struct {
	Hash []byte
}

Md5 represents md5 value

func NewMd5

func NewMd5(data []byte) *Md5

NewMd5 returns a MD5 hash for supplied data

func (*Md5) Decode

func (m *Md5) Decode(encoded string) (err error)

Decode base64 decode

func (*Md5) Encode

func (m *Md5) Encode() string

Encode encode base64 hash value

type Modifier

type Modifier func(info os.FileInfo, reader io.ReadCloser) (os.FileInfo, io.ReadCloser, error)

Modifier option to modify content,

type NoCache

type NoCache struct {
	Source int
}

NoCache represents nocache option

type Override

type Override struct {
	Override bool
}

Override override flag option

type Page

type Page struct {
	// contains filtered or unexported fields
}

Page represents a page

func NewPage

func NewPage(offset, limit int) *Page

NewPage returns a page

func (*Page) HasReachedLimit

func (p *Page) HasReachedLimit() bool

HasReachedLimit returns true if limit has been reaced

func (*Page) Increment

func (p *Page) Increment() int

Increment increment counter

func (*Page) MaxResult

func (p *Page) MaxResult() int64

MaxResult returns max results or zero

func (*Page) ShallSkip

func (p *Page) ShallSkip() bool

ShallSkip returns true if item needs to be skipped

type Source

type Source storage.Options

Source represents source options

func NewSource

func NewSource(options ...storage.Option) *Source

NewSource returns new source options

type Timeout

type Timeout struct {
	time.Duration
}

Timeout represents timeout option

func NewTimeout

func NewTimeout(durationInMs int) Timeout

NewTimeout creates a new timeout option

Jump to

Keyboard shortcuts

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