Documentation ¶
Index ¶
- type Database
- func (data Database) Close() error
- func (data Database) DeleteEvent(event api.EventManager) error
- func (data Database) EventAlreadyUpdated(event api.EventManager) bool
- func (data Database) ExistsEvent(event api.EventManager) bool
- func (data Database) ExistsSubscriptionFromID(ID string) (ok bool, err error)
- func (data Database) GetEventIDs(subscriptionID string) (eventIDs []string, err error)
- func (data Database) GetExpiredSubscriptions() (subscriptions []api.SubscriptionManager, err error)
- func (data Database) RetrieveAccount(userUUID string, ID string) (account api.AccountManager, err error)
- func (data Database) RetrieveAllSubscriptionsFromUser(principalSubscriptionUUID string, userEmail string, userUUID string) (subscriptions []api.SubscriptionManager, err error)
- func (data Database) RetrieveCalendarFromSubscription(subscriptionID string) (calendar api.CalendarManager, err error)
- func (data Database) RetrieveCalendars(userEmail string, userUUID string, calendarUUID string) (calendar api.CalendarManager, err error)
- func (data Database) RetrieveSyncedEventsWithSubscription(eventID string, subscriptionID string, calendar api.CalendarManager) (events []api.EventManager, found bool, err error)
- func (data Database) SaveEventsRelation(from api.EventManager, to api.EventManager) (err error)
- func (data Database) SavePrincipalEvent(event api.EventManager) (err error)
- func (data Database) StartSync(calendar api.CalendarManager, userUUID string) (err error)
- func (data Database) StopSync(principalSubscriptionUUID string, userEmail string, userUUID string) (err error)
- func (data Database) UpdateAccount(account api.AccountManager)
- func (data Database) UpdateAccountFromSubscription(account api.AccountManager, subscription api.SubscriptionManager) (err error)
- func (data Database) UpdateAccountFromUser(account api.AccountManager, userUUID string) (err error)
- func (data Database) UpdateAllCalendarsFromUser(userUUID string, userEmail string) (err error)
- func (data Database) UpdateCalendarFromUser(calendar api.CalendarManager, userUUID string) (err error)
- func (data Database) UpdateModificationDate(event api.EventManager) error
- func (data Database) UpdateSubscription(subscription api.SubscriptionManager) (err error)
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 (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 ¶
Method that returns if a subscription is stored on DB
func (Database) GetEventIDs ¶
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 ¶
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