db

package
v0.0.0-...-adfe93d Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sql.DB
}

func Open

func Open(connectionString string) (*DB, error)

func (*DB) CreateAccount

func (db *DB) CreateAccount(a *models.Account) error

CreateAccount creates a user account

func (*DB) CreateAllSettings

func (db *DB) CreateAllSettings(a *models.Account) error

CreateAllSettings updates the entire settings column for one user

func (*DB) CreateEvent

func (db *DB) CreateEvent(ce *models.CalendarEvent, accountID int) error

CreateEvent creates a calendar event

func (*DB) CreateRefreshToken

func (db *DB) CreateRefreshToken(te *models.AccountToken) error

CreateRefreshToken creates a user refresh token

func (*DB) CreateTask

func (db *DB) CreateTask(ct *models.CalendarTask, accountID int) error

CreateTask creates a calendar task

func (*DB) DeleteEvent

func (db *DB) DeleteEvent(ce *models.CalendarEvent, accountID int) error

DeleteEvent deletes a calendar event by id

func (*DB) DeleteEventsWithTaskId

func (db *DB) DeleteEventsWithTaskId(ct *models.CalendarTask, accountID int) error

DeleteEventsWithTaskId deletes all events with the supplied task id

func (*DB) DeleteRefreshToken

func (db *DB) DeleteRefreshToken(te *models.AccountToken) error

DeleteRefreshToken deletes a user refresh token

func (*DB) DeleteTask

func (db *DB) DeleteTask(ct *models.CalendarTask, accountID int) error

DeleteTask deletes a calendar task by its id

func (*DB) EmailExists

func (db *DB) EmailExists(email string) bool

EmailExists checks if an email exists

func (*DB) GetAccount

func (db *DB) GetAccount(a *models.Account) error

GetAccount fetches a user account by email

func (*DB) GetEvent

func (db *DB) GetEvent(ce *models.CalendarEvent, accountID int) error

GetEvent fetches a calendar event by id

func (*DB) GetEvents

func (db *DB) GetEvents(accountID, start, amount int, category string) ([]models.CalendarEvent, error)

GetEvents fetches a specified amount of events with an optional category

func (*DB) GetEventsByTaskId

func (db *DB) GetEventsByTaskId(accountID, taskID int) ([]models.CalendarEvent, error)

GetEventsByTaskId fetches all events with the supplied task id

func (*DB) GetEventsInInterval

func (db *DB) GetEventsInInterval(accountID int, from, to time.Time, excludeTask int) ([]models.CalendarEvent, error)

GetEventsInInterval fetches all calendar events between dates from and to. Optionally exclude a task id, call with 0 as excludeTask to not exclude anything.

func (*DB) GetSettingValue

func (db *DB) GetSettingValue(a *models.Account, key string) (string, error)

GetSettingValue gets a user setting using the setting key. The key has to be in the form of "$.<key>", for example "$.preferred_date"

func (*DB) GetSettings

func (db *DB) GetSettings(a *models.Account) error

GetSettings gets all settings for a user

func (*DB) GetTask

func (db *DB) GetTask(ct *models.CalendarTask, accountID int) error

GetTask fetches a calendar task by its id

func (*DB) GetTasks

func (db *DB) GetTasks(accountID, start, amount int, category string) ([]models.CalendarTask, error)

GetTasks fetches the specified amount of calendar tasks

func (*DB) RefreshTokenExists

func (db *DB) RefreshTokenExists(refreshToken string) bool

RefreshTokenExists checks if a refresh token exists

func (*DB) UpdateEvent

func (db *DB) UpdateEvent(ce *models.CalendarEvent, accountID int) error

UpdateEvent updates a calendar event by id

func (*DB) UpdateSettingValue

func (db *DB) UpdateSettingValue(a *models.Account, key string, value interface{}) error

UpdateSettingValue updates a user setting using the setting key. The key has to be in the form of "$.<key>", for example "$.preferred_date"

func (*DB) UpdateTask

func (db *DB) UpdateTask(ct *models.CalendarTask, accountID int) error

UpdateTask updates a calendar task by its id

Jump to

Keyboard shortcuts

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