object

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(url *url.URL, mortConfig *config.Config, obj *FileObject) error

Parse pare given url using appropriate parser it set object Key, Bucket, Parent and transforms

func RegisterParser

func RegisterParser(kind string, fn ParseFnc)

RegisterParser add new kind of function to map of decoders and for config validator

Types

type FileObject

type FileObject struct {
	Uri    *url.URL `json:"uri"`    // original request path
	Bucket string   `json:"bucket"` // request matched bucket
	Key    string   `json:"key"`    // storage path for file with leading slash

	Transforms  transforms.Transforms `json:"transforms"` // list of transform that should be performed
	Storage     config.Storage        `json:"storage"`    // selected storage that should be used
	Parent      *FileObject           // original image for transformed image
	CheckParent bool                  // boolean if we should always check if parent exists

	Debug bool // flag for debug requests
	// contains filtered or unexported fields
}

FileObject is representing parsed request for image or file

func NewFileObject

func NewFileObject(uri *url.URL, mortConfig *config.Config) (*FileObject, error)

NewFileObject create new instance of FileObject uri is request URL mortConfig should be pointer to current buckets config

func NewFileObjectFromPath

func NewFileObjectFromPath(path string, mortConfig *config.Config) (*FileObject, error)

NewFileObjectFromPath create new instance of FileObject path should be request path mortConfig should be pointer to current buckets config

func (*FileObject) HasParent

func (o *FileObject) HasParent() bool

HasParent inform if object has parent

func (*FileObject) HasTransform

func (o *FileObject) HasTransform() bool

HasTransform inform if object has transform

type ParseFnc

type ParseFnc func(url *url.URL, bucketConfig config.Bucket, obj *FileObject) (string, error)

ParseFnc is a function that create object from request url

Jump to

Keyboard shortcuts

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