repo

package
v0.0.0-...-2668dd0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cacher

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

func NewCacher

func NewCacher(rdb *redis.Client) *Cacher

func (*Cacher) Del

func (cr *Cacher) Del(ctx context.Context, key string) (int64, error)

func (*Cacher) GetBytes

func (cr *Cacher) GetBytes(ctx context.Context, key string) ([]byte, error)

func (*Cacher) GetObject

func (cr *Cacher) GetObject(ctx context.Context, key string, out any) error

func (*Cacher) GetString

func (cr *Cacher) GetString(ctx context.Context, key string) (string, error)

func (*Cacher) Set

func (cr *Cacher) Set(ctx context.Context, key string, val any, ex time.Duration) error

func (*Cacher) SetNX

func (cr *Cacher) SetNX(ctx context.Context, key string, val any, ex time.Duration) (bool, error)

func (*Cacher) SetNXObject

func (cr *Cacher) SetNXObject(ctx context.Context, key string, val any, ex time.Duration) (bool, error)

func (*Cacher) SetObject

func (cr *Cacher) SetObject(ctx context.Context, key string, val any, ex time.Duration) error

type Refresher

type Refresher func(context.Context, *oauth2.Token) (*oauth2.Token, error)

type StravaRepo

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

func NewStravaRepo

func NewStravaRepo(db *gorm.DB) *StravaRepo

func (*StravaRepo) CreateActivityRaw

func (sr *StravaRepo) CreateActivityRaw(ctx context.Context, m *model.StravaActivityRaw) error

func (*StravaRepo) CreateDetailedActivity

func (sr *StravaRepo) CreateDetailedActivity(ctx context.Context, e *model.StravaActivityDetail) error

func (*StravaRepo) CreateGoal

func (sr *StravaRepo) CreateGoal(ctx context.Context, g *model.StravaGoal) error

func (*StravaRepo) CreatePushEvent

func (sr *StravaRepo) CreatePushEvent(ctx context.Context, e *model.StravaPushEvent) error

func (*StravaRepo) CreateStreamSet

func (sr *StravaRepo) CreateStreamSet(ctx context.Context, e *model.StravaActivityStream) error

func (*StravaRepo) DeleteGoal

func (sr *StravaRepo) DeleteGoal(ctx context.Context, athleteID, goalID int64) (int64, error)

func (*StravaRepo) GetActivityAggStats

func (sr *StravaRepo) GetActivityAggStats(ctx context.Context, athleteID int64,
	activityType, method, field, start, freq string) (map[string]float64, error)

func (*StravaRepo) GetActivityProgressStats

func (sr *StravaRepo) GetActivityProgressStats(ctx context.Context, athleteID int64,
	activityType, method, field, start string) (float64, error)

func (*StravaRepo) GetAllGoal

func (sr *StravaRepo) GetAllGoal(ctx context.Context, g *model.StravaGoal, opt query.Opt) ([]*model.StravaGoal, error)

func (*StravaRepo) GetDetailedActivity

func (sr *StravaRepo) GetDetailedActivity(ctx context.Context, activityID, athleteID int64,
	opt query.Opt) (*model.StravaActivityDetail, error)

func (*StravaRepo) GetGoal

func (sr *StravaRepo) GetGoal(ctx context.Context, g *model.StravaGoal, opt query.Opt) (*model.StravaGoal, error)

func (*StravaRepo) GetGoalByID

func (sr *StravaRepo) GetGoalByID(ctx context.Context, athleteID, goalID int64, opt query.Opt) (*model.StravaGoal, error)

func (*StravaRepo) GetPushEvent

func (sr *StravaRepo) GetPushEvent(ctx context.Context, athleteID int64, opt query.Opt) (*model.StravaPushEvent, error)

func (*StravaRepo) GetStreamSet

func (sr *StravaRepo) GetStreamSet(ctx context.Context, activityID int64, opt query.Opt) (*model.StravaActivityStream, error)

func (*StravaRepo) QueryDetailedActivity

func (sr *StravaRepo) QueryDetailedActivity(ctx context.Context, athleteID int64,
	params *model.StravaActivityParam, opt query.Opt) (*query.PagingResult, []*model.StravaActivityDetail, error)

func (*StravaRepo) UpdateGoal

func (sr *StravaRepo) UpdateGoal(ctx context.Context, athleteID, goalID int64, params *model.StravaGoalParam) (int64, error)

func (*StravaRepo) UpdatePushEvent

func (sr *StravaRepo) UpdatePushEvent(ctx context.Context, activityID int64, params *model.StravaPushEventParam) (int64, error)

type TokenRepo

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

TokenRepo srv

func NewTokenRepo

func NewTokenRepo(cacher *Cacher) *TokenRepo

func (*TokenRepo) GetToken

func (tr *TokenRepo) GetToken(ctx context.Context, source string, sourceID int64, fn Refresher) (*oauth2.Token, error)

func (*TokenRepo) SaveToken

func (tr *TokenRepo) SaveToken(ctx context.Context, token *oauth2.Token, source string, sourceID int64) error

type UserRepo

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

func NewUserRepo

func NewUserRepo(db *gorm.DB) *UserRepo

func (*UserRepo) Create

func (ur *UserRepo) Create(ctx context.Context, u *model.User) (*model.User, error)

func (*UserRepo) Delete

func (ur *UserRepo) Delete(ctx context.Context, id int64) (int64, error)

func (*UserRepo) Get

func (ur *UserRepo) Get(ctx context.Context, id int64, opt query.Opt) (*model.User, error)

func (*UserRepo) GetByEmail

func (ur *UserRepo) GetByEmail(ctx context.Context, email string, opt query.Opt) (*model.User, error)

func (*UserRepo) GetBySource

func (ur *UserRepo) GetBySource(ctx context.Context, source string, sourceID int64, opt query.Opt) (*model.User, error)

func (*UserRepo) Query

func (ur *UserRepo) Query(ctx context.Context, params *model.UserParam, opt query.Opt) (*query.PagingResult, []*model.User, error)

func (*UserRepo) Update

func (ur *UserRepo) Update(ctx context.Context, id int64, params *model.UserParam) (int64, error)

func (*UserRepo) UpdateByEmail

func (ur *UserRepo) UpdateByEmail(ctx context.Context, email string, params *model.UserParam) (int64, error)

Jump to

Keyboard shortcuts

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