Documentation ¶
Index ¶
- Constants
- func GetMimeType(path string) string
- type File
- func (f *File) Collection() string
- func (f *File) GetBackend() kit.FileBackend
- func (f *File) GetBackendId() string
- func (f *File) GetBackendName() string
- func (f *File) GetBucket() string
- func (f *File) GetData() map[string]interface{}
- func (f *File) GetDescription() string
- func (f *File) GetExtension() string
- func (f *File) GetFullName() string
- func (f *File) GetHash() string
- func (f *File) GetHeight() int
- func (f *File) GetIsImage() bool
- func (f *File) GetMediaType() string
- func (f *File) GetMime() string
- func (f *File) GetName() string
- func (f *File) GetSize() int64
- func (f *File) GetTitle() string
- func (f *File) GetTmpPath() string
- func (f *File) GetType() string
- func (f *File) GetWeight() int
- func (f *File) GetWidth() int
- func (f *File) SetBackend(x kit.FileBackend)
- func (f *File) SetBackendId(x string) error
- func (f *File) SetBackendName(x string)
- func (f *File) SetBucket(x string)
- func (f *File) SetData(x map[string]interface{})
- func (f *File) SetDescription(x string)
- func (f *File) SetExtension(x string)
- func (f *File) SetFullName(x string)
- func (f *File) SetHash(x string)
- func (f *File) SetHeight(x int)
- func (f *File) SetIsImage(x bool)
- func (f *File) SetMediaType(x string)
- func (f *File) SetMime(x string)
- func (f *File) SetName(x string)
- func (f *File) SetSize(x int64)
- func (f *File) SetTitle(x string)
- func (f *File) SetTmpPath(x string)
- func (f *File) SetType(x string)
- func (f *File) SetWeight(x int)
- func (f *File) SetWidth(x int)
- type FileIntId
- func (f *FileIntId) Base64() (string, apperror.Error)
- func (f *FileIntId) GetParentFile() kit.File
- func (f *FileIntId) GetParentFileId() interface{}
- func (f *FileIntId) GetRelatedFiles() []kit.File
- func (f *FileIntId) Reader() (kit.ReadSeekerCloser, apperror.Error)
- func (f *FileIntId) SetParentFile(file kit.File)
- func (f *FileIntId) SetParentFileId(id interface{})
- func (f *FileIntId) SetRelatedFiles(rawFiles []kit.File)
- func (f *FileIntId) Writer(create bool) (string, io.WriteCloser, apperror.Error)
- type FileService
- func (h *FileService) AddBackend(backend kit.FileBackend)
- func (h *FileService) Backend(name string) kit.FileBackend
- func (h FileService) BuildFile(file kit.File, user kit.User, deleteDir, deleteFile bool) apperror.Error
- func (h FileService) BuildFileFromPath(bucket, path string, deleteFile bool) (kit.File, apperror.Error)
- func (h *FileService) Create(f kit.File, u kit.User) apperror.Error
- func (s *FileService) Debug() bool
- func (h *FileService) DefaultBackend() kit.FileBackend
- func (h *FileService) Delete(f kit.File, u kit.User) apperror.Error
- func (h *FileService) DeleteById(id interface{}, user kit.User) apperror.Error
- func (h *FileService) Find(q *db.Query) ([]kit.File, apperror.Error)
- func (h *FileService) FindOne(id string) (kit.File, apperror.Error)
- func (h *FileService) Model() kit.Model
- func (h *FileService) New() kit.File
- func (s *FileService) Registry() kit.Registry
- func (h *FileService) Resource() kit.Resource
- func (s *FileService) SetDebug(x bool)
- func (h *FileService) SetDefaultBackend(name string)
- func (h *FileService) SetModel(x kit.Model)
- func (s *FileService) SetRegistry(x kit.Registry)
- func (h *FileService) SetResource(x kit.Resource)
- func (h *FileService) Update(f kit.File, u kit.User) apperror.Error
- type FileStrId
- func (f *FileStrId) Base64() (string, apperror.Error)
- func (f *FileStrId) GetParentFile() kit.File
- func (f *FileStrId) GetParentFileId() interface{}
- func (f *FileStrId) GetRelatedFiles() []kit.File
- func (f *FileStrId) Reader() (kit.ReadSeekerCloser, apperror.Error)
- func (f *FileStrId) SetParentFile(file kit.File)
- func (f *FileStrId) SetParentFileId(id interface{})
- func (f *FileStrId) SetRelatedFiles(rawFiles []kit.File)
- func (f *FileStrId) Writer(create bool) (string, io.WriteCloser, apperror.Error)
- type FilesResource
- type ImageInfo
Constants ¶
View Source
const ( MEDIA_TYPE_IMAGE = "image" MEDIA_TYPE_VIdEO = "video" )
Variables ¶
This section is empty.
Functions ¶
func GetMimeType ¶
Types ¶
type File ¶
type File struct { Backend kit.FileBackend `db:"-"` BackendName string `db:"required;max:100"` BackendId string `db:"required;max:150"` Bucket string `db:"required;max:150"` // Used to store the tmp file path before it is persisted to the backend. TmpPath string Name string `db:"required;max:1000"` Extension string `db:"max:100"` FullName string `db:"required;max:1100"` Title string `db:"max:100"` Description string `db:""` Size int64 Mime string MediaType string IsImage bool Width int Height int // Can be used for sorting. Weight int // Hash is an MD5 hash of the file contents. Hash string `db:"max:50"` // Can be used for categorization. Type string `db:"max:200"` // Stores any additional data required. Data map[string]interface{} `db:"marshal"` }
File that can be extended. You can use FileIntId or FileStrId in almost all cases.
func (*File) Collection ¶
func (*File) GetBackend ¶
func (f *File) GetBackend() kit.FileBackend
func (*File) GetBackendId ¶
func (*File) GetBackendName ¶
func (*File) GetDescription ¶
func (*File) GetExtension ¶
func (*File) GetFullName ¶
func (*File) GetIsImage ¶
func (*File) GetMediaType ¶
func (*File) GetTmpPath ¶
func (*File) SetBackend ¶
func (f *File) SetBackend(x kit.FileBackend)
func (*File) SetBackendId ¶
func (*File) SetBackendName ¶
func (*File) SetDescription ¶
func (*File) SetExtension ¶
func (*File) SetFullName ¶
func (*File) SetIsImage ¶
func (*File) SetMediaType ¶
func (*File) SetTmpPath ¶
type FileIntId ¶
type FileIntId struct { File db.IntIdModel users.IntUserModel ParentFile *FileIntId ParentFileId uint64 RelatedFiles []*FileIntId `db:"belongs-to:Id:ParentFileId"` }
func (*FileIntId) Base64 ¶
Note: needs to be duplicated for FileIntId because access to Id field is required.
func (*FileIntId) GetParentFile ¶
func (*FileIntId) GetParentFileId ¶
func (f *FileIntId) GetParentFileId() interface{}
func (*FileIntId) GetRelatedFiles ¶
func (*FileIntId) Reader ¶
func (f *FileIntId) Reader() (kit.ReadSeekerCloser, apperror.Error)
Note: needs to be duplicated for FileIntId because access to Id field is required.
func (*FileIntId) SetParentFile ¶
func (*FileIntId) SetParentFileId ¶
func (f *FileIntId) SetParentFileId(id interface{})
func (*FileIntId) SetRelatedFiles ¶
type FileService ¶
type FileService struct {
// contains filtered or unexported fields
}
func NewFileService ¶
func NewFileService(registry kit.Registry) *FileService
func NewFileServiceWithFs ¶
func NewFileServiceWithFs(registry kit.Registry, dataPath string) *FileService
func (*FileService) AddBackend ¶
func (h *FileService) AddBackend(backend kit.FileBackend)
func (*FileService) Backend ¶
func (h *FileService) Backend(name string) kit.FileBackend
func (FileService) BuildFileFromPath ¶
func (h FileService) BuildFileFromPath(bucket, path string, deleteFile bool) (kit.File, apperror.Error)
func (*FileService) Debug ¶
func (s *FileService) Debug() bool
func (*FileService) DefaultBackend ¶
func (h *FileService) DefaultBackend() kit.FileBackend
func (*FileService) DeleteById ¶
func (h *FileService) DeleteById(id interface{}, user kit.User) apperror.Error
func (*FileService) Model ¶
func (h *FileService) Model() kit.Model
func (*FileService) New ¶
func (h *FileService) New() kit.File
func (*FileService) Registry ¶
func (s *FileService) Registry() kit.Registry
func (*FileService) Resource ¶
func (h *FileService) Resource() kit.Resource
func (*FileService) SetDebug ¶
func (s *FileService) SetDebug(x bool)
func (*FileService) SetDefaultBackend ¶
func (h *FileService) SetDefaultBackend(name string)
func (*FileService) SetModel ¶
func (h *FileService) SetModel(x kit.Model)
func (*FileService) SetRegistry ¶
func (s *FileService) SetRegistry(x kit.Registry)
func (*FileService) SetResource ¶
func (h *FileService) SetResource(x kit.Resource)
type FileStrId ¶
type FileStrId struct { File db.StrIdModel users.StrUserModel ParentFile *FileStrId ParentFileId string RelatedFiles []*FileStrId `db:"belongs-to:Id:ParentFileId"` }
func (*FileStrId) Base64 ¶
Note: needs to be duplicated for FileStrId because access to Id field is required.
func (*FileStrId) GetParentFile ¶
func (*FileStrId) GetParentFileId ¶
func (f *FileStrId) GetParentFileId() interface{}
func (*FileStrId) GetRelatedFiles ¶
func (*FileStrId) Reader ¶
func (f *FileStrId) Reader() (kit.ReadSeekerCloser, apperror.Error)
Note: needs to be duplicated for FileStrId because access to Id field is required.
func (*FileStrId) SetParentFile ¶
func (*FileStrId) SetParentFileId ¶
func (f *FileStrId) SetParentFileId(id interface{})
func (*FileStrId) SetRelatedFiles ¶
type FilesResource ¶
type FilesResource struct {
// contains filtered or unexported fields
}
func (FilesResource) HttpRoutes ¶
func (hooks FilesResource) HttpRoutes(res kit.Resource) []kit.HttpRoute
Click to show internal directories.
Click to hide internal directories.