database

package
Version: v0.0.0-...-795a8d7 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(url string) *sql.DB

Connect creates a connection pool to the database

func NewDatastore

func NewDatastore(db *sql.DB) datastore.Datastore

NewDatastore returns a new Datastore

Types

type Execstore

type Execstore struct {
	*sqlx.DB
}

Execstore in database

func NewExecstore

func NewExecstore(db *sqlx.DB) *Execstore

NewExecstore datastore

func (*Execstore) Executions

func (db *Execstore) Executions() (executions []model.Execution, err error)

Executions get the executions that should be made

type Tokenstore

type Tokenstore struct {
	*sqlx.DB
}

Tokenstore in database

func NewTokenstore

func NewTokenstore(db *sqlx.DB) *Tokenstore

NewTokenstore datastore

func (*Tokenstore) SaveToken

func (db *Tokenstore) SaveToken(userID int64, token *oauth2.Token) error

SaveToken saves a token

func (*Tokenstore) Schedule

func (db *Tokenstore) Schedule(userID int64, date time.Time) error

Schedule schedules a new execution at the given time

type Userdatastore

type Userdatastore struct {
	*sqlx.DB
}

Userdatastore in database

func NewUserdatastore

func NewUserdatastore(db *sqlx.DB) *Userdatastore

NewUserdatastore datastore

func (*Userdatastore) FollowerCount

func (db *Userdatastore) FollowerCount(userID int64) (count int, err error)

FollowerCount returns the amount of followers stored for a given userID

func (*Userdatastore) GetFollowers

func (db *Userdatastore) GetFollowers(userID int64) ([]string, error)

GetFollowers of a given userID

func (*Userdatastore) GetStars

func (db *Userdatastore) GetStars(userID int64) (result []model.Star, err error)

GetStars of a given userID

func (*Userdatastore) RepositoryCount

func (db *Userdatastore) RepositoryCount(userID int64) (count int, err error)

RepositoryCount returns the amount of followers stored for a given userID

func (*Userdatastore) SaveFollowers

func (db *Userdatastore) SaveFollowers(userID int64, followers []string) error

SaveFollowers for a given userID

func (*Userdatastore) SaveStars

func (db *Userdatastore) SaveStars(userID int64, stars []model.Star) error

SaveStars for a given userID

func (*Userdatastore) StarCount

func (db *Userdatastore) StarCount(userID int64) (count int, err error)

StarCount returns the amount of stargazers of all the user's repositories

func (*Userdatastore) UserExist

func (db *Userdatastore) UserExist(userID int64) (result bool, err error)

UserExist returns true if an user is already registered in the db

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL