Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileTypeFromID ¶
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
Click to show internal directories.
Click to hide internal directories.