mstore

package module
v0.0.0-...-f1bfae6 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2015 License: BSD-3-Clause Imports: 4 Imported by: 0

README

mstore

GoDoc Build Status License

An all-too-simple data de/serializer. It reads and writes data in a format similar to raw email or raw http requests.

example

Header-Name: val/value; type=val
Another-Header: single value

This is the payload which can actually be anything. Content-Type/Length headers aren't determinitive.

Documentation

Overview

Package mstore provides a means for serializing data in a format similar to raw email or http requests. Messages compose headers and a body. The advantage to this is Messages are both human readable and machine parsable. It is HIGHLY recommended that each Message be stored in its own file as a typical MBOX file uses a bare `From` line to seperate each message and mstore only uses two blank lines.

Index

Constants

View Source
const EOL = "\r\n"

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Meta http.Header
	Body bytes.Buffer
}

Messages have two parts: Meta and Body. Messages very closely resemble a raw email message or raw HTTP request with the absence of a few distinctive headers.

func NewMessage

func NewMessage() Message

Creates a new Message

func (*Message) ReadFrom

func (p *Message) ReadFrom(r io.Reader) error

Read from r, parsing into Message{ Meta, Body }

func (*Message) String

func (p *Message) String() string

String provides a simple API to viewing the final payload (Headers + Body) as a string.

func (*Message) Write

func (p *Message) Write(b []byte) (int, error)

Writes to the Message.Body can be done by message.Write. There is no need to force using Message.Body.Write() on the API

func (*Message) WriteTo

func (p *Message) WriteTo(w io.Writer) error

Write to w; an empty header or empty body has to be accounted from with an additional newline

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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