Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DocumentFactory ¶
type DocumentFactory struct{}
DocumentFactory is responsible for creating document processors based on file extensions. It supports .xlsx, .xls (Excel), .docx, .doc (Word), and .pdf (PDF).
func NewDocumentFactory ¶
func NewDocumentFactory() *DocumentFactory
NewDocumentFactory creates a new DocumentFactory instance.
type DocumentType ¶
type DocumentType int
DocumentType represents the type of document.
const ( // TypeUnknown represents an unknown document type. TypeUnknown DocumentType = iota // TypeExcel represents an Excel document type. TypeExcel // TypeWord represents a Word document type. TypeWord // TypePDF represents a PDF document type. TypePDF )
type ExcelFluent ¶
type ExcelFluent struct {
// contains filtered or unexported fields
}
ExcelFluent provides fluent entry points for Excel documents.
func (ExcelFluent) New ¶
func (f ExcelFluent) New(ctx context.Context) (document.Spreadsheet, error)
func (ExcelFluent) Open ¶
func (f ExcelFluent) Open(ctx context.Context, uri string) (document.Spreadsheet, error)
type PDFFluent ¶
type PDFFluent struct {
// contains filtered or unexported fields
}
PDFFluent provides fluent entry points for PDF documents.
type S3Config ¶
type S3Config struct {
// Endpoint is the S3 endpoint URL.
Endpoint string
// AccessKeyID is the access key for S3.
AccessKeyID string
// SecretAccessKey is the secret key for S3.
SecretAccessKey string
// UseSSL enables SSL/TLS for S3 connections.
UseSSL bool
// Region is the S3 region.
Region string
}
S3Config contains settings for S3-compatible storage.
type StorageProvider ¶
type StorageProvider interface {
Open(ctx context.Context, uri string) (io.ReadCloser, error)
Save(ctx context.Context, uri string, reader io.Reader) error
}
StorageProvider defines the interface for opening and saving documents from different storage types.
type Thoth ¶
type Thoth struct {
// contains filtered or unexported fields
}
Thoth provides high-level document processing operations. It acts as a central hub for document creation, storage, and processing.
func New ¶
New creates a new Thoth instance with a default logger and factory. It uses a default ThothStorage which handles local files and basic URLs.
func (*Thoth) Excel ¶
func (t *Thoth) Excel() ExcelFluent
Excel returns fluent entry points for Excel.
func (*Thoth) WithS3Config ¶
WithS3Config sets the S3 configuration for Thoth by updating its storage provider. This allows Thoth to open documents from s3:// URIs.
func (*Thoth) WithStorage ¶
func (t *Thoth) WithStorage(storage StorageProvider) *Thoth
WithStorage sets a custom storage provider for Thoth. This is useful for implementing custom storage backends (e.g., GCS, Azure Blob Storage).
type ThothStorage ¶
type ThothStorage struct {
// contains filtered or unexported fields
}
ThothStorage implements the StorageProvider interface for multiple storage types.
func NewThothStorage ¶
func NewThothStorage(s3Config *S3Config) *ThothStorage
NewThothStorage creates a new ThothStorage with the provided S3 configuration.
func (*ThothStorage) Open ¶
func (s *ThothStorage) Open(ctx context.Context, uri string) (io.ReadCloser, error)
Open opens a reader for the given URI, supporting local files, HTTP, and S3.
type WordFluent ¶
type WordFluent struct {
// contains filtered or unexported fields
}
WordFluent provides fluent entry points for Word documents.
func (WordFluent) New ¶
func (f WordFluent) New(ctx context.Context) (document.WordProcessor, error)
func (WordFluent) Open ¶
func (f WordFluent) Open(ctx context.Context, uri string) (document.WordProcessor, error)