driver

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package driver defines interfaces to be implemented by calendar drivers as used by package cal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attendee

type Attendee interface {
	// Name of the attendee
	Name() string

	// Email of the attendee
	Email() string

	// Phone number of the attendee
	Phone() string
}

Attendee of an Event

type Conn

type Conn interface {
	// GetEvents returns events with a given time range. Further searching
	// should be done on the retrieved events.
	GetEvents(dt.TimeRange) ([]Event, error)

	// Close the connection.
	Close() error
}

Conn is a connection to the external calendar service.

type Driver

type Driver interface {
	// Open returns a new connection to the calendar server. The name is a
	// string in a driver-specific format. A database connection is passed
	// in to enable the driver to retrieve existing auth tokens.
	Open(db *sqlx.DB, name string) (Conn, error)
}

Driver is the interface that must be implemented by a calendar driver.

type Event

type Event interface {
	// Title of the event
	Title() string

	// Location of the event in a free-form string
	Location() string

	// StartTime of the event
	StartTime() *time.Time

	// DurationInMins of the event. This is used rather than an endtime to
	// keep client implementations simple and prevent mixing timezones
	// between start and end dates.
	DurationInMins() int

	// Recurring specifies if the event happens more than once.
	Recurring() bool

	// RecurringFreq specifies how often the event occurs.
	RecurringFreq() RecurringFreq

	// AllDay specifies whether the event is running all day.
	AllDay() bool

	// Attendees of the event
	Attendees() []*Attendee

	// Create the event on the remote server.
	Create() error

	// Update the event on the remote server.
	Update() error
}

Event represents a single event in a calendar.

type RecurringFreq

type RecurringFreq int

RecurringFreq specifies how often an event recurs.

const (
	RecurringFreqOnce RecurringFreq = iota
	RecurringFreqDaily
	RecurringFreqWeekly
	RecurringFreqMonthly
	RecurringFreqYearly
)

Define options for event recurring frequencies.

Jump to

Keyboard shortcuts

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