goworkouts

package module
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: MIT Imports: 10 Imported by: 0

README

goworkouts

Read & write FIT workout files, translate them to JSON

Documentation

Index

Constants

View Source
const MaxUint = ^uint32(0)

MaxUint maximum int value (default in fit)

Variables

This section is empty.

Functions

func WriteFit

func WriteFit(f string, w *fit.File, overwrite bool) (ok bool, err error)

WriteFit writes FIT file from Workout

Types

type ListOfPlans added in v0.9.1

type ListOfPlans struct {
	Plans []TrainingPlan `json:"plans" yaml:"plans"`
}

ListOfPlans storing list of plans

type NewTrainingPlan added in v0.9.1

type NewTrainingPlan struct {
	Filename     string        `json:"filename" yaml:"filename"`
	Name         string        `json:"name" yaml:"name"`
	TrainingDays []TrainingDay `json:"trainingDays" yaml:"trainingDays"`
	Duration     uint32        `json:"duration" yaml:"duration"` // in number of calendar days
	Description  string        `json:"description" yaml:"description"`
}

NewTrainingPlan type for training plans that do not exist yet

type TrainingDay

type TrainingDay struct {
	Order    uint32    `json:"order" yaml:"order"` // how manieth calendar day
	Workouts []Workout `json:"workouts" yaml:"workouts"`
}

TrainingDay is a training day in the training plan

type TrainingPlan

type TrainingPlan struct {
	ID           uuid.UUID     `json:"ID" yaml:"ID"`
	Filename     string        `json:"filename" yaml:"filename"`
	Name         string        `json:"name" yaml:"name"`
	TrainingDays []TrainingDay `json:"trainingDays" yaml:"trainingDays"`
	Duration     uint32        `json:"duration" yaml:"duration"` // in number of calendar days
	Description  string        `json:"description" yaml:"description"`
}

TrainingPlan is a training plan

type Workout

type Workout struct {
	Filename    string        `json:"filename" yaml:"filename"`
	Name        string        `json:"workoutName" yaml:"workoutName"`
	Steps       []WorkoutStep `json:"steps" yaml:"steps"`
	Sport       string        `json:"sport" yaml:"sport"`
	Description string        `json:"description" yaml:"description"`
}

Workout is a Workout

func FromJSON

func FromJSON(s string) (Workout, error)

FromJSON returns workout from json string

func FromYAML added in v0.9.0

func FromYAML(s string) (Workout, error)

FromYAML returns workout from YAML

func ReadFit

func ReadFit(f string) (Workout, error)

ReadFit Read FIT file

func (*Workout) ToFIT

func (w *Workout) ToFIT() (*fit.File, error)

ToFIT exports to FIT only creates empty FIT object for now

func (*Workout) ToJSON

func (w *Workout) ToJSON() ([]byte, error)

ToJSON export to JSON

func (*Workout) ToYAML added in v0.9.0

func (w *Workout) ToYAML() ([]byte, error)

ToYAML export to YAML

type WorkoutStep added in v0.10.5

type WorkoutStep struct {
	MessageIndex          fit.MessageIndex `json:"stepId" yaml:"stepId"`
	WktStepName           string           `json:"wkt_step_name" yaml:"wkt_step_name"`
	DurationType          string           `json:"durationType" yaml:"durationType"`
	DurationValue         uint32           `json:"durationValue" yaml:"durationValue"`
	TargetType            string           `json:"targetType" yaml:"targetType"`
	TargetValue           uint32           `json:"targetValue" yaml:"targetValue"`
	CustomTargetValueLow  uint32           `json:"targetValueLow" yaml:"targetValueLow"`
	CustomTargetValueHigh uint32           `json:"targetValueHigh" yaml:"targetValueHigh"`
	Intensity             string           `json:"intensity" yaml:"intensity"`
	Notes                 string           `json:"description" yaml:"description"`
}

WorkoutStep is the container of a Workout Step

Jump to

Keyboard shortcuts

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