Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CurrentVersion uint32 = 1
CurrentVersion the current format version used for encoding and decoding
var ErrBookNoteFound = errors.New("Note how unknown book")
ErrBookNoteFound indicates that the parser encountered a Note record that referenced a Book the parse has not parsed yet.
var ErrHeaderNotParsed = errors.New("Header have not been parsed yet")
ErrHeaderNotParsed indicates that the Header was not read before attempting to read a record
var ErrHeaderNotWritten = errors.New("Header have not been written yet")
ErrHeaderNotWritten indicates that the Header was not written before attempting to write a record.
var ErrInvalidOrCorruptedBinaryFormat = errors.New("Invalid or corrupted binary")
ErrInvalidOrCorruptedBinaryFormat indicates that parser encountered an problem with the QNOT stream and is unable to continue.
var ErrInvalidRecordType = errors.New("Encountered an invalid record type")
ErrInvalidRecordType indicates a invalid record was encountered. See RecordType for a list of valid records types.
var ErrInvalidString = errors.New("Encountered an invalid record string")
ErrInvalidString indicates the parser encountered a string that does not meets the requirements of Entity's field (such as a string was to long)
var ErrTagNoteFound = errors.New("Note how unknown tag")
ErrTagNoteFound indicates that the parser encountered a Note record that referenced a Tag the parse has not parsed yet.
var HeaderLen = 16
HeaderLen length of the header block
var MagicStr = "QNOT"
MagicStr binary magic string
Functions ¶
This section is empty.
Types ¶
type BinaryDecoder ¶
BinaryDecoder Decodes a QNOT file into a list of Notes
func NewBinaryDecoder ¶
func NewBinaryDecoder(r io.Reader) *BinaryDecoder
NewBinaryDecoder returns a new BinaryDecoder
func (*BinaryDecoder) ParseHeader ¶
func (d *BinaryDecoder) ParseHeader() error
ParseHeader parses the Header block This must be called before calling ParseNotes() It is an error not to
func (*BinaryDecoder) ParseNotes ¶
func (d *BinaryDecoder) ParseNotes() (<-chan *note.Note, error)
ParseNotes starts the parser and returns a Note channel Must call ParseHeader() first or an error is returned
type BinaryEncoder ¶
type BinaryEncoder struct {
// contains filtered or unexported fields
}
BinaryEncoder encodes a Note into the QNOT format
func NewBinaryEncoder ¶
func NewBinaryEncoder(w io.Writer) *BinaryEncoder
NewBinaryEncoder returns a new BinaryEncoder
func (*BinaryEncoder) WriteHeader ¶
func (b *BinaryEncoder) WriteHeader() (uint64, error)
WriteHeader writes the Header block to w. This must be called before any Note can be encoded Calling WriteHeader() more than once has no effect.
func (*BinaryEncoder) WriteNote ¶
func (b *BinaryEncoder) WriteNote(n *note.Note) (uint64, error)
WriteNote encodes a Note, it's Book, and Tags then writes them to w. Books and Tags are only encoded and written to w once. Meaning, if they are encountered again in a different note, they will not be encoded again.
type RecordType ¶
type RecordType byte
RecordType byte indicating the type of record
var ( Book RecordType = 0 Tag RecordType = 1 Note RecordType = 2 )
List of record types