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 ¶
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) 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.
Click to show internal directories.
Click to hide internal directories.