dayone

package module
v0.0.0-...-61997bf Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2015 License: MIT Imports: 11 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    `plist:"Device Agent"`
	GenerationDate time.Time `plist:"Generation Date"`
	HostName       string    `plist:Host Name"`
	OSAgent        string    `plist:OS Agent"`
	SoftwareAgent  string    `plist: Software Agent"`
}

Creator is the creator of a journal entry.

type Entry

type Entry struct {
	EntryText string `plist:"Entry Text"`

	Activity        string
	IgnoreStepCount bool   `plist:"Ignore Step Count"`
	StepCount       uint64 `plist:"Step Count"`

	Starred    bool
	PublishURL string `plist:"Publish URL"`
	Music      *Music

	Tags     []string
	Weather  *Weather
	Location *Location

	TimeZone     string `plist:"Time Zone"`
	Creator      *Creator
	CreationDate time.Time `plist:"Creation Date"`
	// contains filtered or unexported fields
}

Entry is the top-level journal entry type.

func NewEntry

func NewEntry() *Entry

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.

func (Journal) Write

func (j Journal) Write(e *Entry) error

Write creates a new entry

type Location

type Location struct {
	AdministrativeArea string `plist:"Adminstrative Area"`
	Country            string
	Locality           string
	PlaceName          string `plist:"Place Name"`
	Region             *Region
	FoursquareID       string

	Coordinate
}

Location of a journal entry.

type Music

type Music struct {
	Album     string
	Artist    string
	Track     string
	AlbumYear string `plist:"Album Year"`
}

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 `plist:"Pressure MB"`
	RelativeHumidity float64 `plist:"Relative Humidity"`
	Service          string
	SunriseDate      time.Time `plist:"Sunrise Date"`
	SunsetDate       time.Time `plist:"Sunset Date"`
	VisibilityKM     float64   `plist:"Visibility KM"`
	WindBearing      uint64    `plist:"Wind Bearing"`
	WindChillCelsius int64     `plist:"Wind Chill Celsius"`
	WindSpeedKPH     float64   `plist:"Wind Speed KPH"`
}

Weather data for a journal entry.

Jump to

Keyboard shortcuts

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