Documentation ¶
Index ¶
Constants ¶
const ( Img = "image" // Application is provide because the type from the document's mimetype // is defined as application, not document. Both are supported. Application = "application" Doc = "document" Text = "text" )
Variables ¶
This section is empty.
Functions ¶
func SupportedFileTypes ¶
SupportedFileTypes returns a map with the underlying file type, given a sub-type.
Types ¶
type Document ¶
type Document interface {
DocumentType() string
}
Document interface is the one that defines what a document is in this context. It's responsible to return kind of the underlying document.
type DocumentFactory ¶
type DocumentFactory struct {
// contains filtered or unexported fields
}
DocumentFactory implements the FileFactory interface.
func NewDocumentFactory ¶
func NewDocumentFactory(filename string) *DocumentFactory
type File ¶
type File interface { SupportedFormats() map[string][]string SupportedMIMETypes() map[string][]string ConvertTo(string, string, io.Reader) (io.Reader, error) }
File interface is the main interface of the package, that defines what a file is in this context. It's moslty responsible to say other entitites what formats it can be converted to and provides a method to convert the current file given a target format, if supported. SupportedMIMETypes was added to tell between how we see files, categorized by extension, and how they are registered as MIME types. e.g. Kind of document: Microsoft Word (OpenXML) Extension: docx MIME Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
type FileFactory ¶
FileFactory interface is responsible for defining how a FileFactory behaves. It defines a NewFile method that returns an entity that implements the File interface.
func BuildFactory ¶
func BuildFactory(f string, filename string) (FileFactory, error)
BuildFactory is a function responsible to return a FileFactory, given a supported and valid file type, otherwise, it will error out.
type Image ¶
type Image interface {
ImageType() string
}
Image interface is the one that defines what an images is in this context. It's responsible to return kind of the underlying image.