Documentation ¶
Index ¶
- type CarShare
- func (cs *CarShare) AddToManyIDs(name string, IDs []string) error
- func (cs *CarShare) DeleteToManyIDs(name string, IDs []string) error
- func (cs CarShare) GetID() string
- func (cs CarShare) GetReferencedIDs() []jsonapi.ReferenceID
- func (cs CarShare) GetReferencedStructs() []jsonapi.MarshalIdentifier
- func (cs CarShare) GetReferences() []jsonapi.Reference
- func (cs *CarShare) IsAdmin(userID string) bool
- func (cs *CarShare) IsMember(userID string) bool
- func (cs *CarShare) SetID(id string) error
- func (cs *CarShare) SetToManyReferenceIDs(name string, IDs []string) error
- type Score
- type Trip
- func (t *Trip) AddToManyIDs(name string, IDs []string) error
- func (t *Trip) CalculateScores(scoresFromLastTrip map[string]Score) error
- func (t *Trip) DeleteToManyIDs(name string, IDs []string) error
- func (t Trip) GetID() string
- func (t Trip) GetReferencedIDs() []jsonapi.ReferenceID
- func (t Trip) GetReferencedStructs() []jsonapi.MarshalIdentifier
- func (t Trip) GetReferences() []jsonapi.Reference
- func (t *Trip) SetID(id string) error
- func (t *Trip) SetToManyReferenceIDs(name string, IDs []string) error
- func (t *Trip) SetToOneReferenceID(name, ID string) error
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CarShare ¶
type CarShare struct {}
CarShare an individual group of users who make up a car share
func (*CarShare) AddToManyIDs ¶
AddToManyIDs adds some new trips
func (*CarShare) DeleteToManyIDs ¶
DeleteToManyIDs removes some relationships from car shrae
func (CarShare) GetReferencedIDs ¶
func (cs CarShare) GetReferencedIDs() []jsonapi.ReferenceID
GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface
func (CarShare) GetReferencedStructs ¶
func (cs CarShare) GetReferencedStructs() []jsonapi.MarshalIdentifier
GetReferencedStructs to satisfy the jsonapi.MarhsalIncludedRelations interface
func (CarShare) GetReferences ¶
GetReferences to satisfy the jsonapi.MarshalReferences interface
type Score ¶
type Score struct { MetresAsDriver int `json:"metres-as-driver" bson:"metres-as-driver"` MetresAsPassenger int `json:"metres-as-passenger" bson:"metres-as-passenger"` }
A score keeps track of how many miles a user has travelled as a driver and as a passenger
type Trip ¶
type Trip struct { ID bson.ObjectId `json:"-" bson:"_id,omitempty"` Metres int `json:"metres" bson:"metres"` TimeStamp time.Time `json:"timestamp" bson:"timestamp"` Driver *User `json:"-" bson:"-"` DriverID string `json:"-" bson:"driver"` Passengers []*User `json:"-" bson:"-"` PassengerIDs []string `json:"-" bson:"passengers"` Scores map[string]Score `json:"scores" bson:"scores"` }
Trip - a single instance of a car share
func (*Trip) AddToManyIDs ¶
AddToManyIDs to satisfy jsonapi.AddToManyIDs
func (*Trip) CalculateScores ¶
CalculateScores for the trip (basically the ratio between distance travelled as driver and as passenger)
func (*Trip) DeleteToManyIDs ¶
DeleteToManyIDs to satisfy jsonapi.DeleteToManyIDs
func (Trip) GetReferencedIDs ¶
func (t Trip) GetReferencedIDs() []jsonapi.ReferenceID
GetReferencedIDs to satisfy jsonapi.MarshalLinkedRelations interface
func (Trip) GetReferencedStructs ¶
func (t Trip) GetReferencedStructs() []jsonapi.MarshalIdentifier
GetReferencedStructs to satisfy jsonapi.MarshalIncludedRelations interface
func (Trip) GetReferences ¶
GetReferences to satisfy jsonapi.MarshalReferences interface
func (*Trip) SetToManyReferenceIDs ¶
SetToManyReferenceIDs to satisfy jsonapi.UnmarshalToManyRelations
func (*Trip) SetToOneReferenceID ¶
SetToOneReferenceID to satisfy jsonapi.UnmarshalToOneRelations interface
type User ¶
type User struct { ID bson.ObjectId `json:"-" bson:"_id,omitempty"` // users linked to firebase FirebaseUID string `json:"-" bson:"firebase-uid"` DisplayName string `json:"display-name" bson:"display-name"` Email string `json:"-" bson:"email"` PhotoURL string `json:"photo-url" bson:"photo-url"` IsAnon bool `json:"is-anon" bson:"is-anon"` // Used for non firebase users created specifically for a car share }
User of the system