attachment

package
v0.0.0-...-eb0dbd5 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	OriginalFile *upload.OriginalFile
	Dir          *DirManager
	Versions     map[string]FileManager
}

Attachment contain info about directory, base mime type and all files saved.

func Create

func Create(storage string, ofile *upload.OriginalFile, converts map[string]string) (*Attachment, error)

Function recieve root directory, original file, convertaion parametrs. Return Attachment saved.

func (*Attachment) CreateVersion

func (attachment *Attachment) CreateVersion(version string, convert string) (FileManager, error)

Directly save single version and return FileManager.

func (*Attachment) ToJson

func (attachment *Attachment) ToJson() map[string]interface{}

type DirManager

type DirManager struct {
	Root string
	Path string
}

Directory mananger

func CheckDir

func CheckDir(root, path string) (*DirManager, error)

Check path and return DirManager.

func CreateDir

func CreateDir(root, mime string) (*DirManager, error)

Prepare DirManager given root, mime.

func NewDirManager

func NewDirManager(root string) *DirManager

NewDirManager returns a new DirManager given a root.

func (*DirManager) Abs

func (dm *DirManager) Abs() string

Return absolute path for directory

func (*DirManager) CalcPath

func (dm *DirManager) CalcPath(mime string)

Generate path given mime and date.

func (*DirManager) Create

func (dm *DirManager) Create() error

Create directory obtained by concatenating the root and path.

type FileBaseManager

type FileBaseManager struct {
	Dir      *DirManager
	Version  string
	Filename string
}

func (*FileBaseManager) Filepath

func (fbm *FileBaseManager) Filepath() string

func (*FileBaseManager) SetFilename

func (fbm *FileBaseManager) SetFilename(ext string)

func (*FileBaseManager) Url

func (fbm *FileBaseManager) Url() string

type FileDefaultManager

type FileDefaultManager struct {
	*FileBaseManager
	Size int64
}

func (*FileDefaultManager) Convert

func (fdm *FileDefaultManager) Convert(src string, convert string) error

func (*FileDefaultManager) ToJson

func (fdm *FileDefaultManager) ToJson() map[string]interface{}

type FileImageManager

type FileImageManager struct {
	*FileBaseManager
	Width  int
	Height int
	Size   int64
}

func (*FileImageManager) Convert

func (fim *FileImageManager) Convert(src string, convert string) error

Save version from original with convert command-line tool.

func (*FileImageManager) ToJson

func (fim *FileImageManager) ToJson() map[string]interface{}

type FileManager

type FileManager interface {
	Convert(string, string) error
	SetFilename(string)
	ToJson() map[string]interface{}
}

func NewFileManager

func NewFileManager(dm *DirManager, mime_base, version string) FileManager

Return FileManager for given base mime and version.

Jump to

Keyboard shortcuts

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