Documentation ¶
Index ¶
- Constants
- Variables
- type BaseStorage
- type ContentFile
- type File
- type FileSystemFile
- type FileSystemStorage
- func (s *FileSystemStorage) AccessedTime(filepath string) (time.Time, error)
- func (s *FileSystemStorage) CreatedTime(filepath string) (time.Time, error)
- func (s *FileSystemStorage) Delete(filepath string) error
- func (s *FileSystemStorage) Exists(filepath string) bool
- func (s *FileSystemStorage) ModifiedTime(filepath string) (time.Time, error)
- func (s *FileSystemStorage) Open(filepath string) (File, error)
- func (s *FileSystemStorage) Save(filepath string, file File) error
- func (s *FileSystemStorage) SaveWithPermissions(fPath string, file File, perm os.FileMode) error
- func (s *FileSystemStorage) Size(filepath string) int64
- func (s *FileSystemStorage) URL(filename string) string
- type GHAuthor
- type GHCategory
- type GHChidleyRoot314159
- type GHContent
- type GHEntry
- type GHFeed
- type GHField
- type GHId
- type GHLink
- type GHList
- type GHName
- type GHPayload
- type GHPublished
- type GHThumbnail
- type GHTitle
- type GHUpdated
- type GHValue
- type MetadataRoot
- type S3Storage
- func (s *S3Storage) Auth() (auth aws.Auth, err error)
- func (s *S3Storage) Bucket() (*s3.Bucket, error)
- func (s *S3Storage) Client() (*s3.S3, error)
- func (s *S3Storage) Delete(filepath string) error
- func (s *S3Storage) Exists(filepath string) bool
- func (s *S3Storage) Key(filepath string) (*s3.Key, error)
- func (s *S3Storage) ModifiedTime(filepath string) (time.Time, error)
- func (s *S3Storage) Open(filepath string) (File, error)
- func (s *S3Storage) Save(path string, file File) error
- func (s *S3Storage) SaveWithContentType(filepath string, file File, contentType string) error
- func (s *S3Storage) Size(filepath string) int64
- type S3StorageFile
- type Storage
- type VizGHStorage
- func (v *VizGHStorage) Delete(filepath string) error
- func (v *VizGHStorage) Exists(filepath string) bool
- func (v *VizGHStorage) HasBaseURL() bool
- func (v *VizGHStorage) ModifiedTime(filepath string) (time.Time, error)
- func (v *VizGHStorage) Open(filepath string) (File, error)
- func (v *VizGHStorage) Path(filepath string) string
- func (v *VizGHStorage) Save(name string, file File) error
- func (v *VizGHStorage) Size(filepath string) int64
- func (v *VizGHStorage) URL(filename string) string
Constants ¶
View Source
const ( GET = "GET" POST = "POST" PUT = "PUT" DELETE = "DELETE" )
View Source
const LastModifiedFormat = time.RFC1123
Variables ¶
View Source
var ACLs = map[string]s3.ACL{ "private": s3.Private, "public-read": s3.PublicRead, "public-read-write": s3.PublicReadWrite, "authenticated-read": s3.AuthenticatedRead, "bucket-owner-read": s3.BucketOwnerRead, "bucket-owner-full-control": s3.BucketOwnerFull, }
View Source
var DefaultFilePermissions os.FileMode = 0755
Functions ¶
This section is empty.
Types ¶
type BaseStorage ¶
func NewBaseStorage ¶
func NewBaseStorage(location string, baseURL string) *BaseStorage
func (*BaseStorage) HasBaseURL ¶
func (s *BaseStorage) HasBaseURL() bool
func (*BaseStorage) Path ¶
func (s *BaseStorage) Path(fPath string) string
Path joins the given file to the storage path
func (*BaseStorage) URL ¶
func (s *BaseStorage) URL(filename string) string
type ContentFile ¶
func NewContentFile ¶
func NewContentFile(content []byte) *ContentFile
func (*ContentFile) Close ¶
func (f *ContentFile) Close() error
func (*ContentFile) ReadAll ¶
func (f *ContentFile) ReadAll() ([]byte, error)
func (*ContentFile) Size ¶
func (f *ContentFile) Size() int64
type FileSystemFile ¶
func NewFileSystemFile ¶
func NewFileSystemFile(storage Storage, file *os.File) (*FileSystemFile, error)
func (*FileSystemFile) ReadAll ¶
func (f *FileSystemFile) ReadAll() ([]byte, error)
func (*FileSystemFile) Size ¶
func (f *FileSystemFile) Size() int64
type FileSystemStorage ¶
type FileSystemStorage struct {
*BaseStorage
}
Storage is a file system storage handler
func (*FileSystemStorage) AccessedTime ¶
func (s *FileSystemStorage) AccessedTime(filepath string) (time.Time, error)
func (*FileSystemStorage) CreatedTime ¶
func (s *FileSystemStorage) CreatedTime(filepath string) (time.Time, error)
CreatedTime returns the last access time.
func (*FileSystemStorage) Delete ¶
func (s *FileSystemStorage) Delete(filepath string) error
Delete the file from storage
func (*FileSystemStorage) Exists ¶
func (s *FileSystemStorage) Exists(filepath string) bool
Exists checks if the given file is in the storage
func (*FileSystemStorage) ModifiedTime ¶
func (s *FileSystemStorage) ModifiedTime(filepath string) (time.Time, error)
ModifiedTime returns the last update time
func (*FileSystemStorage) Open ¶
func (s *FileSystemStorage) Open(filepath string) (File, error)
Open returns the file content
func (*FileSystemStorage) Save ¶
func (s *FileSystemStorage) Save(filepath string, file File) error
Save saves a file at the given path
func (*FileSystemStorage) SaveWithPermissions ¶
SaveWithPermissions saves a file with the given permissions to the storage
func (*FileSystemStorage) Size ¶
func (s *FileSystemStorage) Size(filepath string) int64
Size returns the size of the given file
func (*FileSystemStorage) URL ¶
func (s *FileSystemStorage) URL(filename string) string
type GHCategory ¶
type GHChidleyRoot314159 ¶
type GHChidleyRoot314159 struct {
GHFeed *GHFeed `xml:"http://www.w3.org/2005/Atom feed,omitempty" json:"feed,omitempty"`
}
type GHEntry ¶
type GHEntry struct { AttrXmlns string `xml:" xmlns,attr" json:",omitempty"` GHCategory *GHCategory `xml:"http://www.w3.org/2005/Atom category,omitempty" json:"category,omitempty"` GHContent *GHContent `xml:"http://search.yahoo.com/mrss/ content,omitempty" json:"content,omitempty"` GHId *GHId `xml:"http://www.w3.org/2005/Atom id,omitempty" json:"id,omitempty"` GHLink []*GHLink `xml:"http://www.w3.org/2005/Atom link,omitempty" json:"link,omitempty"` GHPublished *GHPublished `xml:"http://www.w3.org/2005/Atom published,omitempty" json:"published,omitempty"` GHThumbnail *GHThumbnail `xml:"http://search.yahoo.com/mrss/ thumbnail,omitempty" json:"thumbnail,omitempty"` GHTitle *GHTitle `xml:"http://www.w3.org/2005/Atom title,omitempty" json:"title,omitempty"` GHUpdated *GHUpdated `xml:"http://www.w3.org/2005/Atom updated,omitempty" json:"updated,omitempty"` XMLName xml.Name `xml:"http://www.w3.org/2005/Atom entry,omitempty" json:"entry,omitempty"` }
type GHFeed ¶
type GHFeed struct { AttrXmlnsMedia string `xml:"xmlns media,attr" json:",omitempty"` AttrXmlns string `xml:" xmlns,attr" json:",omitempty"` GHAuthor *GHAuthor `xml:"http://www.w3.org/2005/Atom author,omitempty" json:"author,omitempty"` GHEntry *GHEntry `xml:"http://www.w3.org/2005/Atom entry,omitempty" json:"entry,omitempty"` GHId *GHId `xml:"http://www.w3.org/2005/Atom id,omitempty" json:"id,omitempty"` GHTitle *GHTitle `xml:"http://www.w3.org/2005/Atom title,omitempty" json:"title,omitempty"` GHUpdated *GHUpdated `xml:"http://www.w3.org/2005/Atom updated,omitempty" json:"updated,omitempty"` XMLName xml.Name `xml:"http://www.w3.org/2005/Atom feed,omitempty" json:"feed,omitempty"` }
type GHField ¶
type GHField struct { AttrName string `xml:" name,attr" json:",omitempty"` GHField []*GHField `xml:"http://www.vizrt.com/types field,omitempty" json:"field,omitempty"` GHList *GHList `xml:"http://www.vizrt.com/types list,omitempty" json:"list,omitempty"` GHValue *GHValue `xml:"http://www.vizrt.com/types value,omitempty" json:"value,omitempty"` XMLName xml.Name `xml:"http://www.vizrt.com/types field,omitempty" json:"field,omitempty"` }
type GHPayload ¶
type GHPayload struct { AttrModel string `xml:" model,attr" json:",omitempty"` AttrXmlns string `xml:" xmlns,attr" json:",omitempty"` GHField []*GHField `xml:"http://www.vizrt.com/types field,omitempty" json:"field,omitempty"` XMLName xml.Name `xml:"http://www.vizrt.com/types payload,omitempty" json:"payload,omitempty"` }
type GHPublished ¶
type GHThumbnail ¶
type MetadataRoot ¶
type MetadataRoot struct {
GHPayload *GHPayload `xml:"http://www.vizrt.com/types payload,omitempty" json:"payload,omitempty"`
}
type S3Storage ¶
type S3Storage struct { *BaseStorage AccessKeyId string SecretAccessKey string BucketName string Region aws.Region ACL s3.ACL }
func (*S3Storage) ModifiedTime ¶
ModifiedTime returns the last update time
func (*S3Storage) SaveWithContentType ¶
Save saves a file at the given path in the bucket
type S3StorageFile ¶
type S3StorageFile struct { io.ReadCloser Key *s3.Key Storage Storage }
func (*S3StorageFile) ReadAll ¶
func (f *S3StorageFile) ReadAll() ([]byte, error)
func (*S3StorageFile) Size ¶
func (f *S3StorageFile) Size() int64
type Storage ¶
type Storage interface { Save(filepath string, file File) error Path(filepath string) string Exists(filepath string) bool Delete(filepath string) error Open(filepath string) (File, error) ModifiedTime(filepath string) (time.Time, error) Size(filepath string) int64 URL(filename string) string HasBaseURL() bool }
func NewFileSystemStorage ¶
NewStorage returns a file system storage engine
type VizGHStorage ¶
type VizGHStorage struct { *BaseStorage User string Pass string Expiration time.Duration }
func NewVizGHStorage ¶
func (*VizGHStorage) Delete ¶
func (v *VizGHStorage) Delete(filepath string) error
func (*VizGHStorage) Exists ¶
func (v *VizGHStorage) Exists(filepath string) bool
func (*VizGHStorage) HasBaseURL ¶
func (v *VizGHStorage) HasBaseURL() bool
func (*VizGHStorage) ModifiedTime ¶
func (v *VizGHStorage) ModifiedTime(filepath string) (time.Time, error)
func (*VizGHStorage) Path ¶
func (v *VizGHStorage) Path(filepath string) string
func (*VizGHStorage) Save ¶
func (v *VizGHStorage) Save(name string, file File) error
Save saves a file at the given path; the path is the uuid of a folder we want to save a file to
func (*VizGHStorage) Size ¶
func (v *VizGHStorage) Size(filepath string) int64
func (*VizGHStorage) URL ¶
func (v *VizGHStorage) URL(filename string) string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.