db

package
v0.0.0-...-b10e7cb Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: BSD-3-Clause Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database object for the backend

func New

func New(client *sql.DB, sentry *raven.Client) Database

Function that creates a new database instance

func (Database) Close

func (data Database) Close() error

Method that closes the database

func (Database) DeleteEvent

func (data Database) DeleteEvent(event api.EventManager) error

Deletes event from database

func (Database) EventAlreadyUpdated

func (data Database) EventAlreadyUpdated(event api.EventManager) bool

Returns if an event is already updated. This is because when we create/update/delete an event because a notification of other calendar was sent, we receive a notification for our request, so we store the last update date as not to enter in an infinite loop

func (Database) ExistsEvent

func (data Database) ExistsEvent(event api.EventManager) bool

Returns if an event exists in our db

func (Database) ExistsSubscriptionFromID

func (data Database) ExistsSubscriptionFromID(ID string) (ok bool, err error)

Method that returns if a subscription is stored on DB

func (Database) GetEventIDs

func (data Database) GetEventIDs(subscriptionID string) (eventIDs []string, err error)

Returns all event IDs that are associated with a subscription

func (Database) GetExpiredSubscriptions

func (data Database) GetExpiredSubscriptions() (subscriptions []api.SubscriptionManager, err error)

Retrieves all subscription that are expiring or are expired

func (Database) RetrieveAccount

func (data Database) RetrieveAccount(userUUID string, ID string) (account api.AccountManager, err error)

Method that retrieves an AccountManager from the DB

func (Database) RetrieveAllSubscriptionsFromUser

func (data Database) RetrieveAllSubscriptionsFromUser(principalSubscriptionUUID string, userEmail string, userUUID string) (subscriptions []api.SubscriptionManager, err error)

Returns all subscriptions from a user

func (Database) RetrieveCalendarFromSubscription

func (data Database) RetrieveCalendarFromSubscription(subscriptionID string) (calendar api.CalendarManager, err error)

Method that retrieves a CalendarManager from a subscription

func (Database) RetrieveCalendars

func (data Database) RetrieveCalendars(userEmail string, userUUID string, calendarUUID string) (calendar api.CalendarManager, err error)

Method that retrieves a CalendarManager from the DB

func (Database) RetrieveSyncedEventsWithSubscription

func (data Database) RetrieveSyncedEventsWithSubscription(eventID string, subscriptionID string, calendar api.CalendarManager) (events []api.EventManager, found bool, err error)

Retrieves all the events that are syncing with the given one, if no event is found on db, it creates empty events for every calendar relation

func (Database) SaveEventsRelation

func (data Database) SaveEventsRelation(from api.EventManager, to api.EventManager) (err error)

Saves a relation between two events

func (Database) SavePrincipalEvent

func (data Database) SavePrincipalEvent(event api.EventManager) (err error)

Saves principal event to db. Principal event is the event which was first created

func (Database) StartSync

func (data Database) StartSync(calendar api.CalendarManager, userUUID string) (err error)

Method that starts the sync of a calendar, creating the events and storing them on DB. Also creating subscription and storing them

func (Database) StopSync

func (data Database) StopSync(principalSubscriptionUUID string, userEmail string, userUUID string) (err error)

Method that stops the sync from a calendar, deleting all events on db and stopping subscription and deleting them

func (Database) UpdateAccount

func (data Database) UpdateAccount(account api.AccountManager)

Method that updates the account info

func (Database) UpdateAccountFromSubscription

func (data Database) UpdateAccountFromSubscription(account api.AccountManager, subscription api.SubscriptionManager) (err error)

Method that updates the account info of a subscription

func (Database) UpdateAccountFromUser

func (data Database) UpdateAccountFromUser(account api.AccountManager, userUUID string) (err error)

Method that updates the account info of a user

func (Database) UpdateAllCalendarsFromUser

func (data Database) UpdateAllCalendarsFromUser(userUUID string, userEmail string) (err error)

Method that updates all calendars from a user

func (Database) UpdateCalendarFromUser

func (data Database) UpdateCalendarFromUser(calendar api.CalendarManager, userUUID string) (err error)

Method that updates a calendar from a user

func (Database) UpdateModificationDate

func (data Database) UpdateModificationDate(event api.EventManager) error

Updates modification date on a given event

func (Database) UpdateSubscription

func (data Database) UpdateSubscription(subscription api.SubscriptionManager) (err error)

Method that updates the info of a subscription

Jump to

Keyboard shortcuts

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