Documentation ¶
Overview ¶
Package ud859 is an implementation of the udacity course at http://udacity.com/course/ud859.
Index ¶
- Constants
- func RegisterConferenceAPI(server *endpoints.Server) error
- type Conference
- type ConferenceAPI
- func (ConferenceAPI) CancelConference(c context.Context, form *ConferenceKeyForm) error
- func (ConferenceAPI) ConferencesCreated(c context.Context) (*Conferences, error)
- func (ConferenceAPI) ConferencesToAttend(c context.Context) (*Conferences, error)
- func (ConferenceAPI) CreateConference(c context.Context, form *ConferenceForm) (*ConferenceCreated, error)
- func (ConferenceAPI) GetConference(c context.Context, form *ConferenceKeyForm) (*Conference, error)
- func (ConferenceAPI) GetProfile(c context.Context) (*Profile, error)
- func (ConferenceAPI) GotoConference(c context.Context, form *ConferenceKeyForm) error
- func (ConferenceAPI) QueryConferences(c context.Context, form *ConferenceQueryForm) (*Conferences, error)
- func (ConferenceAPI) SaveProfile(c context.Context, form *ProfileForm) error
- type ConferenceCreated
- type ConferenceForm
- type ConferenceKeyForm
- type ConferenceQueryForm
- type Conferences
- type Filter
- type Profile
- type ProfileForm
Constants ¶
const ( EQ = "=" LT = "<" GT = ">" LTE = "<=" GTE = ">=" NE = "!=" )
Supported query operators.
const ( Name = "NAME" City = "CITY" Topics = "TOPIC" StartDate = "START_DATE" EndDate = "END_DATE" Month = "MONTH" MaxAttendees = "MAX_ATTENDEES" SeatsAvailable = "SEATS_AVAILABLE" )
Conference query fields.
Variables ¶
This section is empty.
Functions ¶
func RegisterConferenceAPI ¶
RegisterConferenceAPI adds the ConferenceAPI to the server.
Types ¶
type Conference ¶
type Conference struct { WebsafeKey string `json:"websafeKey" datastore:"-"` Name string `json:"name" datastore:",noindex"` Description string `json:"description" datastore:",noindex"` Organizer string `json:"organizerDisplayName" datastore:",noindex"` Topics []string `json:"topics" datastore:",noindex"` City string `json:"city" datastore:",noindex"` StartDate time.Time `json:"startDate" datastore:"START_DATE"` EndDate time.Time `json:"endDate" datastore:",noindex"` Month int `json:"-" datastore:",noindex"` MaxAttendees int `json:"maxAttendees" datastore:",noindex"` SeatsAvailable int `json:"seatsAvailable" datastore:",noindex"` }
Conference defines a conference.
type ConferenceAPI ¶
type ConferenceAPI struct{}
ConferenceAPI defines the conferences management API.
func (ConferenceAPI) CancelConference ¶
func (ConferenceAPI) CancelConference(c context.Context, form *ConferenceKeyForm) error
CancelConference cancels the registration to the specified ConferenceKeyForm.
func (ConferenceAPI) ConferencesCreated ¶
func (ConferenceAPI) ConferencesCreated(c context.Context) (*Conferences, error)
ConferencesCreated returns the Conferences created by the current user.
func (ConferenceAPI) ConferencesToAttend ¶
func (ConferenceAPI) ConferencesToAttend(c context.Context) (*Conferences, error)
ConferencesToAttend returns the Conferences to attend by the current user.
func (ConferenceAPI) CreateConference ¶
func (ConferenceAPI) CreateConference(c context.Context, form *ConferenceForm) (*ConferenceCreated, error)
CreateConference creates a Conference in the datastore from the specified ConferenceForm.
func (ConferenceAPI) GetConference ¶
func (ConferenceAPI) GetConference(c context.Context, form *ConferenceKeyForm) (*Conference, error)
GetConference returns the Conference with the specified ConferenceKeyForm.
func (ConferenceAPI) GetProfile ¶
func (ConferenceAPI) GetProfile(c context.Context) (*Profile, error)
GetProfile returns the Profile associated with the current user.
func (ConferenceAPI) GotoConference ¶
func (ConferenceAPI) GotoConference(c context.Context, form *ConferenceKeyForm) error
GotoConference performs the registration to the specified ConferenceKeyForm.
func (ConferenceAPI) QueryConferences ¶
func (ConferenceAPI) QueryConferences(c context.Context, form *ConferenceQueryForm) (*Conferences, error)
QueryConferences searches for Conferences with the specified ConferenceQueryForm.
func (ConferenceAPI) SaveProfile ¶
func (ConferenceAPI) SaveProfile(c context.Context, form *ProfileForm) error
SaveProfile saves the current user's Profile in the datastore from the specified ProfileForm.
type ConferenceCreated ¶
type ConferenceCreated struct { Name string `json:"name"` WebsafeKey string `json:"websafeConferenceKey"` }
ConferenceCreated is returned when a conference is created.
type ConferenceForm ¶
type ConferenceForm struct { Name string `json:"name" endpoints:"req"` Description string `json:"description"` Topics []string `json:"topics"` City string `json:"city"` StartDate string `json:"startDate"` EndDate string `json:"endDate"` MaxAttendees string `json:"maxAttendees"` }
ConferenceForm gives details about a conference to create.
type ConferenceKeyForm ¶
type ConferenceKeyForm struct {
WebsafeKey string `json:"websafeConferenceKey" endpoints:"req"`
}
ConferenceKeyForm wraps a conference websafeKey.
type ConferenceQueryForm ¶
type ConferenceQueryForm struct {
Filters []*Filter `json:"filters"`
}
ConferenceQueryForm wraps a list of filters.
func (*ConferenceQueryForm) Filter ¶
func (q *ConferenceQueryForm) Filter(field string, op string, value interface{}) *ConferenceQueryForm
Filter adds a restriction to the ConferenceQueryForm.
type Conferences ¶
type Conferences struct {
Items []*Conference `json:"items"`
}
Conferences is a list of Conferences.
func (Conferences) Len ¶
func (c Conferences) Len() int
func (Conferences) Less ¶
func (c Conferences) Less(i, j int) bool
func (Conferences) Swap ¶
func (c Conferences) Swap(i, j int)
type Filter ¶
type Filter struct { Field string `endpoints:"req"` Op string `endpoints:"req"` Value interface{} `endpoints:"req"` }
Filter describes a query restriction.
func (*Filter) MarshalJSON ¶
MarshalJSON marshals the Filter as JSON data.
func (*Filter) UnmarshalJSON ¶
UnmarshalJSON unmarshals the JSON data into the Filter.
type Profile ¶
type Profile struct { Email string `json:"-"` DisplayName string `json:"displayName"` TeeShirtSize string `json:"teeShirtSize"` // Conferences is a list of conferences WebsafeKey. Conferences []string `json:"conferenceKeysToAttend"` }
Profile defines an identified user.
func (Profile) IsRegistered ¶
IsRegistered returns true if the user is registered to the specified conference websafeKey.
type ProfileForm ¶
type ProfileForm struct { DisplayName string `json:"displayName"` TeeShirtSize string `json:"teeShirtSize"` }
ProfileForm gives details about a Profile to create or update.