dayone

package module
Version: v0.0.0-...-5363690 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2015 License: MIT Imports: 10 Imported by: 0

README

Day One

A package for reading Day One journal files.

Documentation

Documentation

Overview

Package dayone is for reading Day One (http://dayoneapp.com) journal files.

Index

Constants

This section is empty.

Variables

View Source
var ErrStopRead = errors.New("stop reading")

ErrStopRead is an error you can return from a ReadFunc to stop reading journal entries.

Functions

This section is empty.

Types

type Coordinate

type Coordinate struct {
	Latitude  float64
	Longitude float64
}

Coordinate for location data.

type Creator

type Creator struct {
	DeviceAgent    string
	GenerationDate time.Time
	HostName       string
	OSAgent        string
	SoftwareAgent  string
}

Creator is the creator of a journal entry.

type Entry

type Entry struct {
	EntryText string

	Activity        string
	IgnoreStepCount bool
	StepCount       uint64

	Starred    bool
	PublishURL string
	Music      *Music

	Tags     []string
	Weather  *Weather
	Location *Location

	TimeZone     string
	Creator      *Creator
	CreationDate time.Time
	// contains filtered or unexported fields
}

Entry is the top-level journal entry type.

func (*Entry) UUID

func (e *Entry) UUID() string

UUID gets the unique ID of the entry.

type Journal

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

Journal is the top-level type for reading Day One journal files.

func NewJournal

func NewJournal(dir string) *Journal

NewJournal creates a new Journal for the specified dir.

func (*Journal) EntryStat

func (j *Journal) EntryStat(uuid string) (os.FileInfo, error)

EntryStat returns the result of os.Stat() for the entry with the specified uuid.

func (*Journal) OpenPhoto

func (j *Journal) OpenPhoto(uuid string) (io.ReadCloser, error)

OpenPhoto opens an io.ReadCloser for the photo file associated with the specified entry uuid or returns an error.

func (*Journal) PhotoStat

func (j *Journal) PhotoStat(uuid string) (os.FileInfo, error)

PhotoStat returns the result of os.Stat() for the photo associated with the entry uuid.

func (*Journal) Read

func (j *Journal) Read(fn ReadFunc) error

Read enumerates all of the journal entries and calls fn with each entry found. Errors returned by fn are returned by Read. fn can return StopError to halt enumeration at any point.

func (*Journal) ReadEntry

func (j *Journal) ReadEntry(uuid string) (*Entry, error)

ReadEntry reads the entry with the specified id.

type Location

type Location struct {
	AdministrativeArea string
	Country            string
	Locality           string
	PlaceName          string
	Region             *Region
	FoursquareID       string

	Coordinate
}

Location of a journal entry.

type Music

type Music struct {
	Album     string
	Artist    string
	Track     string
	AlbumYear string
}

Music data for a journal entry.

type ReadFunc

type ReadFunc func(e *Entry, err error) error

ReadFunc is the func to use when enumerating journal entries.

type Region

type Region struct {
	Center *Coordinate
	Radius float64
}

Region location data.

type Weather

type Weather struct {
	Celsius          string
	Fahrenheit       string
	Description      string
	IconName         string
	PressureMB       float64
	RelativeHumidity float64
	Service          string
	SunriseDate      time.Time
	SunsetDate       time.Time
	VisibilityKM     float64
	WindBearing      uint64
	WindChillCelsius int64
	WindSpeedKPH     float64
}

Weather data for a journal entry.

Jump to

Keyboard shortcuts

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