runnerup

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package runnerup provides commands to work with DB exported from RunnerUp app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd

func Cmd()

Cmd defines runnerup subcommand.

Types

type Activity

type Activity struct {
	ID        int          `db:"_id"`
	StartTime TimeStamp    `db:"start_time"`
	Distance  float64      `db:"distance"`
	Time      Seconds      `db:"time"`
	Type      ActivityType `db:"type"`
}

Activity is a DB row that may own multiple items of Location..

type ActivityType

type ActivityType int

ActivityType describes what was happening during tracking.

type Location

type Location struct {
	ID int `db:"_id"`

	ActivityID int         `db:"activity_id"`
	Time       MSTimeStamp `db:"time"`
	Lon        float64     `db:"longitude"`
	Lat        float64     `db:"latitude"`
	Alt        float64     `db:"altitude"`

	Accuracy   float64  `db:"accurancy"`
	Speed      float64  `db:"speed"`
	Bearing    *float64 `db:"bearing"`
	Satellites int      `db:"satellites"`
}

Location is a DB row that holds GPS point, owned by Activity.

type MSTimeStamp

type MSTimeStamp int

MSTimeStamp is a UNIX timestamp in milliseconds.

func (MSTimeStamp) String

func (t MSTimeStamp) String() string

String returns time stamp in RFC 3339 format.

func (MSTimeStamp) Time

func (t MSTimeStamp) Time() time.Time

Time returns time.Time value.

type Repository

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

Repository provides access to DB entities.

func NewRepository

func NewRepository(dbFile string) (*Repository, error)

NewRepository creates a new Repository.

func (*Repository) Close

func (r *Repository) Close() error

Close closes underlying DB connection.

func (*Repository) ListActivities

func (r *Repository) ListActivities(ctx context.Context, limit uint64) ([]Activity, error)

ListActivities returns latest Activity list.

func (*Repository) ListLocations

func (r *Repository) ListLocations(ctx context.Context, activityID int) ([]Location, error)

ListLocations returns all Location points for an Activity ID.

type Seconds

type Seconds int

Seconds defines duration.

func (Seconds) String

func (t Seconds) String() string

type TimeStamp

type TimeStamp int

TimeStamp is a UNIX timestamp in seconds.

func (TimeStamp) String

func (t TimeStamp) String() string

Jump to

Keyboard shortcuts

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