types

package
v0.0.0-...-b7105a7 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileTypeFromID

func FileTypeFromID(i int) string

Types

type AssignRequest

type AssignRequest struct {
	// Currently only a FileType of "image" is supported
	FileType string `json:"type" mapstructure:"type" validate:"validType"`

	// The maximum number of bytes that the uploaded file can be
	// This is a string value so mapstructure can handle it, use MaxSize() to get
	// the int64 value
	MaxSizeStr string `json:"max_size" mapstructure:"max_size" validate:"regexp=^[0-9]*$"`

	// Replication is not used in dank and is just forwarded onto seaweedfs
	Replication string `json:"replication" mapstructure:"replication"`

	// TTL is stored and sent to seaweedfs in the assign and upload steps
	TTL string `json:"ttl" mapstructure:"ttl"`

	// SigExpires sets the expires time on the generated signature to this
	// number of seconds. By default this value is 0 which means don't expire.
	// This is a string value so mapstructure can handle it, use Expires() to
	// get the unix timestamp when the expires is
	SigExpiresStr string `json:"sigExpires" mapstructure:"sig_expires" validate:"regexp=^[0-9]*$"`
}

AssignRequest encompasses the fields optionally used to validate an upload before passing it onto seaweed. Current this only contains type and size but could later contain min image resolution, song duration, etc

func (*AssignRequest) Expires

func (r *AssignRequest) Expires() int64

expires returns at what unix time a signature generated with this request expires or 0 if it never expires

func (*AssignRequest) FileTypeID

func (r *AssignRequest) FileTypeID() int

func (*AssignRequest) MaxSize

func (r *AssignRequest) MaxSize() int64

func (*AssignRequest) URLValues

func (r *AssignRequest) URLValues() url.Values

type Assignment

type Assignment struct {
	Signature string `json:"sig" mapstructure:"sig"  validate:"nonzero"`
	Filename  string `json:"filename"  mapstructure:"filename" validate:"nonzero"`
}

Assignment holds a signature and a filename which are needed to upload a file and validate it. Since mapstructure doesn't support embedded structs we have to copy these to main.go's uploadArgs

Jump to

Keyboard shortcuts

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