queries

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDBAccountExists

func CheckDBAccountExists(a *server.App, accountID string) (bool, error)

func CheckDBSessionExists

func CheckDBSessionExists(a *server.App, sessionID string) (bool, error)

func CheckDBUserExists

func CheckDBUserExists(a *server.App) (bool, error)

func CheckDBUserIsGood

func CheckDBUserIsGood(a *server.App, userInfo *GithubUserInfo) (bool, error)

If there is already a user, we compare the login and email to see if it is the same user

func CreateOrUpdateDBSession

func CreateOrUpdateDBSession(a *server.App, accessToken string, browserInfo string) error

func CreateUser

func CreateUser(a *server.App, accessToken string, browserInfo string, userInfo *GithubUserInfo) error

CreateUser creates a new user along with the associated account, provider, and session.

func DeleteDBSession

func DeleteDBSession(a *server.App, accountID string, sessionID string) error

DeleteSession deletes the session from the database.

func ExtendSessionExpiration

func ExtendSessionExpiration(a *server.App, accountID string, sessionID string, newExpirationTime time.Time) error

func GetAccountCount

func GetAccountCount(a *server.App) (int, error)

func GetDBUserSession

func GetDBUserSession(a *server.App, accessToken string, browserInfo string) (*db.Sessions, error)

GetDBUserSession gets the user session from the database based on the access token and browser info.

func GetSessionExpiration

func GetSessionExpiration(a *server.App, accountID string, sessionID string, currentTime time.Time) (time.Time, error)

func InspectInMemoryDB

func InspectInMemoryDB(a *server.App) error

InspectInMemoryDB inspects the in-memory database. (for debug purpose)

func InvalidateDBSession

func InvalidateDBSession(a *server.App, sessionID string) error

func PopulateAccountFromDB

func PopulateAccountFromDB(a *server.App) error

func PopulateProviderFromDB

func PopulateProviderFromDB(a *server.App) error

func UpdateUser

func UpdateUser(a *server.App, accessToken string, browserInfo string, userInfo *GithubUserInfo) (*db.User, error)

Types

type GithubUserInfo

type GithubUserInfo struct {
	Login      string `json:"login"`
	AvatarURL  string `json:"avatar_url"`
	ProfileURL string `json:"html_url"`
	Emails     []string
}

UserInfo holds the essential information for a Github user.

Jump to

Keyboard shortcuts

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