Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBadEvent ¶
IsBadEvent applies some heuristics to remove spammy events or expensive ones that aren't practical to show up at without previous notice.
Not sure if I want to keep this since it makes things less random. Perhaps there's some machine learning magic I can do to filter events while minimizing bias?
Types ¶
type Dest ¶
type Dest struct { ID DestID `json:"id"` UserID UserID `json:"userID"` EventID EventID `json:"eventID"` // Used to side-load event data when sending dest list to the client Event *Event `json:"event,omitempty"` Status string `json:"status"` Feedback string `json:"feedback"` CreatedAt time.Time `json:"createdAt"` }
Dest records a User's destination: a random event selected for them to attend.
It can be updated with feedback from the user and information about whether they went or not.
type DestGenerateReply ¶
type DestGenerateReply struct { Result DestGenerateResult `json:"result"` Dests []Dest `json:"dests"` Events []Event `json:"events"` }
DestGenerateReply is returned in response to a DestGenerateRequest. It reports whether a new destination was generated, and lists a few of the most recently generated destinations.
type DestGenerateRequest ¶
type DestGenerateRequest struct { UserID UserID `json:"userID"` Lat float64 `json:"lat"` Lng float64 `json:"lng"` }
DestGenerateRequest is a request for a Dest at a given location.
It's sent by the client to get their next random event.
type DestGenerateResult ¶
type DestGenerateResult string
DestGenerateResult describes whether or not a DestGenerate request was fulfilled, and if not why.
const ( // GenerateOK means a destination was generated successfully. GenerateOK DestGenerateResult = "ok" // GenerateWait means the user needs to wait a while before requesting a new // destination, and no destination was generated. GenerateWait DestGenerateResult = "wait" // GenerateNoResults means that no upcoming events were found in the requested // area. Try again later or in another place. GenerateNoResults DestGenerateResult = "no-results" // GenerateError means there was a problem generating the event, try again later GenerateError DestGenerateResult = "error" )
type DestListRequest ¶
type DestListRequest struct {
Page int `json:"page"`
}
A DestListRequest requests a piece of the user's dest list.
type DestUpdate ¶
type DestUpdate struct { Feedback string `json:"feedback"` Status string `json:"status"` // Mask is a comma-delimited list of json names for the fields this update // will change. Only fields listed in the mask will be updated. // // eg: "feedback" means this update changes only Feedback. // // This is similar to protobuf's FieldMask well known type. Mask string `json:"mask"` }
A DestUpdate allows a user to update a Dest with feedback.
type Event ¶
type Event struct { // These fields are extracted from the Facebook Graph API response ID EventID `json:"id"` Name string `json:"name"` Description string `json:"description"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` StartTime time.Time `json:"start_time"` EndTime time.Time `json:"end_time"` IsCanceled bool `json:"is_canceled"` Cover string `json:"cover"` Place string `json:"place"` Address string `json:"address"` // IsBad is a flag used to filter events that don't work well on the service. // // But what is bad, really? I'm thinking about removing this field and // replacing it with something more thoroughly thought out. See the discussion // at IsBadEvent(). IsBad bool `json:"is_bad"` }
Event describes a (random) Facebook event.
type EventID ¶
type EventID string
EventID is a string assigned by Facebook that uniquely identifies the Event. You can access the event it references at https://facebook.com/<event id>.
type EventSearchRequest ¶
type EventSearchRequest struct { Bounds string `json:"bounds"` Start time.Time `json:"start"` End time.Time `json:"end"` IncludeBad bool `json:"includeBad"` }
EventSearchRequest is passed to EventStore.Search to find events at a certain time and place.
type EventSubmitRequest ¶
type EventSubmitRequest struct { // EventIDs are the Facebook Event IDs. // // Submissions can be batched for efficiency. Up to 50 ids may be submitted at a time. EventIDs []EventID `json:"event_ids"` }
An EventSubmitRequest is a request to add a facebook event to the event database.
type User ¶
type User struct { ID UserID `json:"id"` TimeZone string `json:"timeZone"` FacebookID string `json:"facebookID"` FacebookToken string `json:"facebookToken"` Birthday time.Time `json:"birthday"` }
User stores metadata about a Third Party user
type UserUpdate ¶
type UserUpdate struct { TimeZone string `json:"timeZone"` FacebookID string `json:"facebookID"` FacebookToken string `json:"facebookToken"` Birthday time.Time `json:"birthday"` // Mask is a comma-delimited list of json names for the fields this update // will change. Only fields listed in the mask will be updated. // // eg: "timeZone,birthday" means this update changes TimeZone and Birthday // // This is similar to protobuf's FieldMask well known type. Mask string `json:"mask"` }
A UserUpdate is used to update a User object
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
eventdb
package main provides a command line interface for starting the eventdb REST API.
|
package main provides a command line interface for starting the eventdb REST API. |
eventdb-token
package main provides a utility for creating service tokens for authenticating with eventdb via firebase
|
package main provides a utility for creating service tokens for authenticating with eventdb via firebase |
Package errors contains the error handling used by eventdb.
|
Package errors contains the error handling used by eventdb. |
pgtest
Package pgtest provides utilities for creating and destroying test databases in PostgreSQL.
|
Package pgtest provides utilities for creating and destroying test databases in PostgreSQL. |
Package prom contains prometheus metrics exported by eventdb.
|
Package prom contains prometheus metrics exported by eventdb. |
Package rest contains a REST handler for eventdb.
|
Package rest contains a REST handler for eventdb. |