sync

package
v0.0.0-...-389db3d Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateRKDifference

func CalculateRKDifference(rkActivities dm.ActivitySet, stvActivities dm.ActivitySet) *dm.ActivitySet

* Returns the set of activities that are in RunKeeper, but not in Strava. * So if the set of Runkeeper activites is A, and the set of Strava activities is B, * this function calculates B\A.

Types

type DbSync

type DbSync struct {
	ConnectionString string
}

func (DbSync) CountActiveUsers

func (db DbSync) CountActiveUsers() (int, error)

func (DbSync) CreateTableIfNotExist

func (db DbSync) CreateTableIfNotExist() error

func (DbSync) FindSyncTaskByToken

func (db DbSync) FindSyncTaskByToken(token string) (*SyncTask, error)

func (DbSync) RetrieveAllSyncTasks

func (db DbSync) RetrieveAllSyncTasks() ([]SyncTask, error)

func (DbSync) StoreSyncTask

func (db DbSync) StoreSyncTask(sync SyncTask) (int64, int64, SyncTask, error)

* Returns 1) Created Id, 2) Rows changed/added, 3)synctask, 4) error

func (DbSync) UpdateSyncTask

func (db DbSync) UpdateSyncTask(sync SyncTask) (int, error)

type DbSyncInt

type DbSyncInt interface {
	UpdateSyncTask(sync SyncTask) (int, error)
	StoreSyncTask(sync SyncTask) (int64, int64, SyncTask, error)
	RetrieveAllSyncTasks() ([]SyncTask, error)
	FindSyncTaskByToken(token string) (*SyncTask, error)
	CreateTableIfNotExist() error
	CountActiveUsers() (int, error)
}

func CreateSyncDbRepo

func CreateSyncDbRepo(dbString string) DbSyncInt

type SyncTask

type SyncTask struct {
	StravaToken           string `json:"stv_token"`
	StravaRefreshToken    string `json:"stv_refresh_token"`
	RunkeeperToken        string `json:"rk_token"`
	RunkeeperRefreshToken string `json:"rk_refresh_token"`
	LastSeenTimestamp     int    `json:"last_seen_ts"`
	Uid                   int64  `json:"id"`
	Environment           string `json:"environment"`
}

func CreateSyncTask

func CreateSyncTask(rkToken string, stvToken string, rkRefreshToken string, stvRefreshToken string, lastSeenTS int, environment string) *SyncTask

func (SyncTask) String

func (st SyncTask) String() string

func (SyncTask) Sync

func (st SyncTask) Sync(stvClient stv.StravaClientInt, rkClient rk.RunkeeperCientInt, txn newrelic.Transaction) (int, int, error)

* return the Total difference and the number of Activites created

type Syncer

type Syncer interface {
	Sync() (int, int, error)
}

Jump to

Keyboard shortcuts

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