Documentation
¶
Index ¶
- func CopyFile(src, dst string) (err error)
- type Backend
- func (be *Backend) BinExists(bin string) bool
- func (be *Backend) DeleteBin(bin string) (Bin, error)
- func (be *Backend) DeleteFile(bin string, filename string) (File, error)
- func (be *Backend) GenerateLinks(bin string, filename string) []Link
- func (be *Backend) GenerateThumbnail(bin string, filename string, width int, height int, crop bool) error
- func (be *Backend) GetBinArchive(bin string, format string, w http.ResponseWriter) (io.Writer, string, error)
- func (be *Backend) GetBinMetaData(bin string) (Bin, error)
- func (be *Backend) GetBins() []string
- func (be *Backend) GetBinsMetaData() []Bin
- func (be *Backend) GetFile(bin string, filename string) (io.ReadSeeker, error)
- func (be *Backend) GetFileMetaData(bin string, filename string) (File, error)
- func (be *Backend) GetFiles(bin string) []string
- func (be *Backend) GetThumbnail(bin string, filename string, width int, height int) (io.ReadSeeker, error)
- func (be *Backend) Info() string
- func (be *Backend) NewBin(bin string) Bin
- func (be *Backend) UploadFile(bin string, filename string, data io.ReadCloser) (File, error)
- type Bin
- type BinsByUpdatedAt
- type File
- type FilesByDateTime
- type FilesByFilename
- type Link
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶
http://stackoverflow.com/a/21067803 CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.
Types ¶
type Backend ¶
type Backend struct {
sync.RWMutex
Bytes int64 `json:"bytes"`
Log *log.Logger `json:"-"`
// contains filtered or unexported fields
}
func InitBackend ¶
func (*Backend) DeleteFile ¶
func (*Backend) GenerateLinks ¶
func (*Backend) GenerateThumbnail ¶
func (*Backend) GetBinArchive ¶
func (*Backend) GetBinsMetaData ¶
func (*Backend) GetFileMetaData ¶
func (*Backend) GetThumbnail ¶
func (*Backend) UploadFile ¶
type Bin ¶
type Bin struct {
Bin string `json:"bin"`
Bytes int64 `json:"bytes"`
BytesReadable string `json:"-"`
ExpiresAt time.Time `json:"expires"`
ExpiresReadable string `json:"-"`
Expired bool `json:"-"`
UpdatedAt time.Time `json:"updated"`
UpdatedReadable string `json:"-"`
Files []File `json:"files,omitempty"`
Album bool `json:"-"`
}
type BinsByUpdatedAt ¶
type BinsByUpdatedAt []Bin
Sort bins by Update At
func (BinsByUpdatedAt) Len ¶
func (a BinsByUpdatedAt) Len() int
func (BinsByUpdatedAt) Less ¶
func (a BinsByUpdatedAt) Less(i, j int) bool
func (BinsByUpdatedAt) Swap ¶
func (a BinsByUpdatedAt) Swap(i, j int)
type File ¶
type File struct {
Filename string `json:"filename"`
Bin string `json:"bin"`
Bytes int64 `json:"bytes"`
MIME string `json:"mime"`
CreatedAt time.Time `json:"created"`
Links []Link `json:"links"`
// Image specific attributes
DateTime time.Time `json:"datetime,omitempty"`
Longitude float64 `json:"longitude,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
}
func (File) BytesReadable ¶
func (File) CreatedReadable ¶
func (*File) DateTimeReadable ¶
func (*File) DateTimeString ¶
type FilesByDateTime ¶
type FilesByDateTime []File
Sort files by DateTime
func (FilesByDateTime) Len ¶
func (a FilesByDateTime) Len() int
func (FilesByDateTime) Less ¶
func (a FilesByDateTime) Less(i, j int) bool
func (FilesByDateTime) Swap ¶
func (a FilesByDateTime) Swap(i, j int)
type FilesByFilename ¶
type FilesByFilename []File
Sort files by filename
func (FilesByFilename) Len ¶
func (a FilesByFilename) Len() int
func (FilesByFilename) Less ¶
func (a FilesByFilename) Less(i, j int) bool
func (FilesByFilename) Swap ¶
func (a FilesByFilename) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.