Documentation
¶
Index ¶
Constants ¶
View Source
const BytesPerMegabyte = 1024 * 1024
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AType ¶
type AType string
func DetectType ¶
DetectType determines the file type based on its extension. Falls back to Document if unknown.
type Attachment ¶
type Attachment struct {
AType AType
FileName string
SizeBytes int64
File io.ReadCloser // todo rename to FileReadCloser
}
func (*Attachment) Close ¶
func (a *Attachment) Close() error
type Attachments ¶
type Attachments []*Attachment
func (Attachments) Close ¶
func (a Attachments) Close() error
type FileOpener ¶
type FileOpener interface {
Open(string) (*OpenedFile, error)
}
type Loader ¶
type Loader struct {
FileOpener FileOpener
IsEverythingDocument bool
MaxTotalAttachments int
MaxPhotoAttachmentSizeBytes int64
MaxAttachmentSizeBytes int64
MaxTotalSizeBytes int64
}
Loader validates and loads attachments according to configured limits.
func (*Loader) LoadMultipleAttachments ¶
func (l *Loader) LoadMultipleAttachments(filePaths []string) (Attachments, error)
type OSFileOpener ¶
type OSFileOpener struct{}
func NewOSFileOpener ¶
func NewOSFileOpener() *OSFileOpener
func (*OSFileOpener) Open ¶
func (o *OSFileOpener) Open(path string) (*OpenedFile, error)
type OpenedFile ¶
type OpenedFile struct {
File io.ReadCloser
SizeBytes int64
}
Click to show internal directories.
Click to hide internal directories.