core

package
v0.0.0-...-4d6acc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 15 Imported by: 0

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.

func (*DocumentFactory) Create

func (f *DocumentFactory) Create(filename string) (document.Document, error)

Create returns a new Document processor for the given filename. The processor type is determined by the file extension.

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 (ExcelFluent) Open

type PDFFluent

type PDFFluent struct {
	// contains filtered or unexported fields
}

PDFFluent provides fluent entry points for PDF documents.

func (PDFFluent) New

func (PDFFluent) Open

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

func New(logger zerolog.Logger) *Thoth

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) PDF

func (t *Thoth) PDF() PDFFluent

PDF returns fluent entry points for PDF.

func (*Thoth) WithS3Config

func (t *Thoth) WithS3Config(config S3Config) *Thoth

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).

func (*Thoth) Word

func (t *Thoth) Word() WordFluent

Word returns fluent entry points for Word.

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.

func (*ThothStorage) Save

func (s *ThothStorage) Save(ctx context.Context, uri string, reader io.Reader) error

Save writes the content of reader to the given URI.

type WordFluent

type WordFluent struct {
	// contains filtered or unexported fields
}

WordFluent provides fluent entry points for Word documents.

func (WordFluent) New

func (WordFluent) Open

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL