Documentation ¶
Index ¶
- type Contribution
- type Database
- func (db Database) AddContribution(contribution *Contribution, user *User) (err error)
- func (db Database) AddUser(user *User) (newUser User, err error)
- func (db Database) FetchNewUsers() (users []User, err error)
- func (db Database) GetExpiringUsers() (users []User, err error)
- func (db Database) GetUserData(userID string) (usr User, err error)
- func (db Database) UpdateUser(user *User) (err error)
- func (db Database) VerifyConnection() (err error)
- type User
- type UserContribution
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contribution ¶
type Contribution struct { ContributionID string UserAgent string Distance int TimeStampStart time.Time TimeStampStop time.Time Duration int PointsGeom *geo.Path PointsTime []time.Time }
Contribution : Struct to respresent a contribution object from the database
type Database ¶
type Database struct { PostgresHost string PostgresUser string PostgresPassword string PostgresPort int64 PostgresDb string PostgresRequireSSL string }
Database : Struct to hold the database connection
func (Database) AddContribution ¶
func (db Database) AddContribution(contribution *Contribution, user *User) (err error)
AddContribution : Create new user contribution
func (Database) FetchNewUsers ¶
FetchNewUsers : Fetch an array of new users that have not yet fetched their old data
func (Database) GetExpiringUsers ¶
GetExpiringUsers : Get users which are expiring within half an hour
func (Database) GetUserData ¶
GetUserData : Request a user token for the ID
func (Database) UpdateUser ¶
UpdateUser : Update an existing user
func (Database) VerifyConnection ¶
VerifyConnection : Connect to Postgres
type User ¶
type User struct { ID string UserIdentifier string Provider string ProviderUser string AccessToken string RefreshToken string TokenCreationDate time.Time ExpiresAt int ExpiresIn int IsHistoryFetched bool }
User : Struct to respresent a user object from the database
type UserContribution ¶
UserContribution : Struct to respresent a UserContribution object from the database
Click to show internal directories.
Click to hide internal directories.