Documentation ¶
Index ¶
- Constants
- Variables
- type Chunk
- type ChunkAttachment
- type ChunkRepository
- type ContentTypeDetector
- type File
- type FileQuery
- type FileQueryResult
- type FileRepository
- type HTTPFileLocator
- type HTTPHandler
- type Hash
- type QueryOrder
- type Range
- type Reader
- type Status
- type UUID
- type Uploads
- func (u *Uploads) Copy(ctx context.Context, w io.Writer, uuid UUID) error
- func (u *Uploads) CopyRange(ctx context.Context, w io.Writer, uuid UUID, ra Range) error
- func (u *Uploads) Delete(ctx context.Context, file *File) error
- func (u *Uploads) Download(using HTTPFileLocator) HTTPHandler
- func (u *Uploads) FileByUUID() HTTPFileLocator
- func (u *Uploads) Reader(ctx context.Context, file *File) (*Reader, error)
- func (u *Uploads) Save(ctx context.Context, f *File, r io.ReadSeeker) (err error)
- func (u *Uploads) Upload(field string, sizeLimit int64) HTTPHandler
- func (u *Uploads) Writer(ctx context.Context, file *File) (*writer, error)
Constants ¶
View Source
const ( StatusUnkown Status = iota StatusUploading StatusCancelled StatusError StatusComplete StatusDeleted QueryOrderByUnknown QueryOrder = iota QueryOrderByStatus QueryOrderBySize QueryOrderByCreated QueryOrderByUpdated QueryOrderByDeleted )
Variables ¶
View Source
var ( ErrIncompleteCopy = errors.New("failed to copy all the bytes") ErrStorageFull = errors.New("storage is overwhelmed") )
View Source
var (
ErrContentTypeNotAllowed = errors.New("detected content type is not allowed")
)
Functions ¶
This section is empty.
Types ¶
type ChunkRepository ¶
type ChunkRepository interface { ChunkCreate(context.Context, *File, *Chunk) error ChunkRetrieve(context.Context, UUID) (*Chunk, error) ChunkDelete(context.Context, UUID) error ChunkAttachmentList(context.Context, UUID) ([]*ChunkAttachment, error) ChunkStorageUsage(context.Context) (uint64, error) }
type ContentTypeDetector ¶
type ContentTypeDetector func(io.ReadSeeker) (string, error)
ContentTypeDetector reads the head of a ReadSeeker and attempts to determine the underlying content type.
func NewContentTypeDetector ¶
func NewContentTypeDetector(allowed ...string) ContentTypeDetector
NewContentTypeDetector returns a function that returns a content type, if it is in the allowed list. If the allowed list is `nil`, all content types are accepted. Inherits "application/octet-stream" as default.
type FileQueryResult ¶
type FileRepository ¶
type HTTPHandler ¶
type HTTPHandler func(http.ResponseWriter, *http.Request) error
type QueryOrder ¶
type QueryOrder uint8
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
type Uploads ¶
type Uploads struct {
// contains filtered or unexported fields
}
func (*Uploads) Download ¶
func (u *Uploads) Download(using HTTPFileLocator) HTTPHandler
func (*Uploads) FileByUUID ¶
func (u *Uploads) FileByUUID() HTTPFileLocator
Source Files ¶
Click to show internal directories.
Click to hide internal directories.