loaders

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DocumentBoundary = []byte("\n---\n")

DocumentBoundary determines where markdown files are chunked.

Functions

func PathAutoJoin

func PathAutoJoin(prefix, file string) string

PathAutoJoin appends prefix to file path, if file path is relative, handles URL paths correctly.

Types

type DocumentChunkReader

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

DocumentChunkReader provides a reader interface to a document reader. Seperates the stream into chunks by detecting provided boundary.

func NewDocumentChunkReader

func NewDocumentChunkReader(r io.Reader, boundary []byte) *DocumentChunkReader

NewDocumentChunkReader returns a reader with pre-loaded buffer.

func (*DocumentChunkReader) Next

func (d *DocumentChunkReader) Next() bool

Next returns "true" if there is another document that can be read in the stream.

func (*DocumentChunkReader) Read

func (d *DocumentChunkReader) Read(b []byte) (n int, err error)

type Loader

type Loader interface {
	Load(source string, r io.Reader) (*Message, error)
}

Loader parses recepients out of data streams.

type Message

type Message struct {
	Source             string // file from which the message is generated
	Current            *Participant
	Date               string
	Subject            string
	From               string
	ReplyTo            string
	Comments           string
	Keywords           string
	To                 *[]Participant
	CC                 *[]Participant
	ListID             string
	BCC                *[]Participant
	UnsubscribeContact *Participant
	UnsubscribeLink    *url.URL
	Attachments        []string
	Body               []byte
	Data               map[string]interface{}
}

Message models an email message.

func (*Message) MIMEHeader

func (m *Message) MIMEHeader() textproto.MIMEHeader

MIMEHeader provides MIME fields for the renderer.

type Participant

type Participant struct {
	Name   string
	Email  string
	Source string
	Data   map[string]interface{}
}

Participant is a person or agent in "to", "from", "cc", and "bcc" fields.

func (Participant) String

func (p Participant) String() string

type ViperLoader

type ViperLoader struct{}

ViperLoader constructs message using viper config parser from a markdown file.

func (*ViperLoader) Load

func (l *ViperLoader) Load(source string, r io.Reader) (*Message, error)

Load processes the markdown file into a message structure.

Jump to

Keyboard shortcuts

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