dayligo

package module
v0.0.0-...-9f4347d Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: MIT Imports: 10 Imported by: 0

README

dayligo

Dayligo is a library for working with Daylio backup files in the .daylio format. It contains a definition of the internal structure of this file, utility functions for packing and unpacking these backups, and an example script used to import Habit backups into Daylio.

I wrote a little bit about how it works on my blog.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backup

type Backup struct {
	DayEntries       []DayEntry        `json:"dayEntries"`
	Goals            []Goal            `json:"goals"`
	GoalEntries      []GoalEntry       `json:"goalEntries"`
	GoalSuccessWeeks []GoalSuccessWeek `json:"goalSuccessWeeks"`
	Tags             []Tag             `json:"tags"`
	Version          int64             `json:"version"`
	// contains filtered or unexported fields
}

func ReadBackupFromFile

func ReadBackupFromFile(path string) (*Backup, error)

func (*Backup) Close

func (b *Backup) Close() error

Close cleans up created temp directory.

func (*Backup) WriteToFile

func (b *Backup) WriteToFile(path string) error

type DayEntry

type DayEntry struct {
	DateTime       int64   `json:"datetime"`
	Mood           int64   `json:"mood"`
	Note           string  `json:"note"`
	Tags           []int64 `json:"tags"`
	Hour           int64   `json:"hour"`
	Minute         int64   `json:"minute"`
	Day            int64   `json:"day"`
	Month          int64   `json:"month"`
	Year           int64   `json:"year"`
	TimeZoneOffset int64   `json:"timeZoneOffset"`

	// Not parsed
	Assets []json.RawMessage `json:"assets"`
}

type Goal

type Goal struct {
	CreatedAt       int64  `json:"created_at"`
	ID              int64  `json:"goal_id"`
	AvatarID        int64  `json:"id_avatar"`
	ChallengeID     int64  `json:"id_challenge"`
	IconID          int64  `json:"id_icon"`
	TagID           int64  `json:"id_tag"`
	Name            string `json:"name"`
	OrderNumber     int64  `json:"order_number"`
	ReminderEnabled bool   `json:"reminder_enabled"`
	ReminderHour    int64  `json:"reminder_hour"`
	ReminderMinute  int64  `json:"reminder_minute"`
	RepeatType      int64  `json:"repeat_type"`
	RepeatValue     int64  `json:"repeat_value"`
	State           int64  `json:"state"`
}

type GoalEntry

type GoalEntry struct {
	CreatedAt int64 `json:"createdAt"`
	Hour      int64 `json:"hour"`
	Minute    int64 `json:"minute"`
	Second    int64 `json:"second"`
	Day       int64 `json:"day"`
	Month     int64 `json:"month"`
	Year      int64 `json:"year"`
	GoalID    int64 `json:"goalId"`
	ID        int64 `json:"id"`
}

type GoalSuccessWeek

type GoalSuccessWeek struct {
	CreateAtDay   int64 `json:"create_at_day"`
	CreateAtMonth int64 `json:"create_at_month"`
	CreateAtYear  int64 `json:"create_at_year"`
	GoalID        int64 `json:"goal_id"`
	Week          int64 `json:"week"`
	Year          int64 `json:"year"`
}

type Tag

type Tag struct {
	CreatedAt int64  `json:"createdAt"`
	Icon      int64  `json:"icon"`
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	Order     int64  `json:"order"`
	State     int64  `json:"state"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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