core

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Between

func Between(s, sub1, sub2 string) string

func Equal

func Equal(w1, w2 *Weight) bool

func RandString

func RandString(size, base byte) string

RandString base10 - numbers, base16 - hex, base36 - digits+letters base64 - URL safe symbols, base0 - crypto random

Types

type Account

type Account interface {
	Login(username, password string) error
	GetAllWeights() ([]*Weight, error)
}

type AccountWithAddWeights added in v0.3.0

type AccountWithAddWeights interface {
	AddWeights(weights []*Weight) error
	DeleteWeight(weight *Weight) error
	Equal(a, b *Weight) bool
}

type AccountWithFilter added in v0.2.0

type AccountWithFilter interface {
	GetFilterWeights(name string) ([]*Weight, error)
}

type AccountWithToken

type AccountWithToken interface {
	Account
	LoginWithToken(token string) error
	Token() string
}

type Weight

type Weight struct {
	// main data
	Date   time.Time `json:"Date"`
	Weight float32   `json:"Weight"` // kg

	// almost all scales
	BMI       float32 `json:"BMI,omitempty"`
	BodyFat   float32 `json:"BodyFat,omitempty"`   // percent
	BodyWater float32 `json:"BodyWater,omitempty"` // percent
	BoneMass  float32 `json:"BoneMass,omitempty"`  // kg

	// some scales
	MetabolicAge   int     `json:"MetabolicAge,omitempty"`   // years
	MuscleMass     float32 `json:"MuscleMass,omitempty"`     // kg
	PhysiqueRating int     `json:"PhysiqueRating,omitempty"` // 1-9
	ProteinMass    float32 `json:"ProteinMass,omitempty"`    // kg
	VisceralFat    int     `json:"VisceralFat,omitempty"`    // 1-12 or 13-59

	// rare scales
	BasalMetabolism    int     `json:"BasalMetabolism,omitempty"`    // kcal, Basal Metabolic Rate (BMR)
	BodyScore          int     `json:"BodyScore,omitempty"`          // points
	HeartRate          int     `json:"HeartRate,omitempty"`          // beats per minute
	Height             float32 `json:"Height,omitempty"`             // cm
	SkeletalMuscleMass float32 `json:"SkeletalMuscleMass,omitempty"` // kg

	User   string `json:"User,omitempty"`
	Source string `json:"Source,omitempty"`
}

Jump to

Keyboard shortcuts

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