Documentation
¶
Index ¶
- func GetRankName(rank int) string
- type AlertModel
- func (model AlertModel) Create(alertType AlertType) (*mongo.InsertOneResult, error)
- func (model AlertModel) DeleteByID(id primitive.ObjectID) (*mongo.UpdateResult, error)
- func (model AlertModel) FindByID(id primitive.ObjectID) (AlertType, error)
- func (model AlertModel) FindByName(name string) (AlertType, error)
- func (model AlertModel) FindMany(q bson.M) ([]AlertType, error)
- func (model AlertModel) UpdateByID(id primitive.ObjectID, alertType AlertType) (*mongo.UpdateResult, error)
- type AlertType
- type Entry
- type Location
- type LocationRanking
- type Ranking
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlertModel ¶
type AlertModel struct{}
AlertModel ...
func (AlertModel) Create ¶
func (model AlertModel) Create(alertType AlertType) (*mongo.InsertOneResult, error)
Create ...
func (AlertModel) DeleteByID ¶
func (model AlertModel) DeleteByID(id primitive.ObjectID) (*mongo.UpdateResult, error)
DeleteByID ...
func (AlertModel) FindByID ¶
func (model AlertModel) FindByID(id primitive.ObjectID) (AlertType, error)
FindByID ...
func (AlertModel) FindByName ¶
func (model AlertModel) FindByName(name string) (AlertType, error)
FindByName ...
func (AlertModel) FindMany ¶
func (model AlertModel) FindMany(q bson.M) ([]AlertType, error)
FindMany ...
func (AlertModel) UpdateByID ¶
func (model AlertModel) UpdateByID(id primitive.ObjectID, alertType AlertType) (*mongo.UpdateResult, error)
UpdateByID exposes a function to update an entry by it's ID
type AlertType ¶
type AlertType struct { ID primitive.ObjectID `json:"_id" bson:"_id"` Name string `json:"name" bson:"name" validate:"required"` Level int `json:"level" bson:"level" validate:"required"` Status string `json:"status" bson:"status"` Created time.Time `json:"created" bson:"created"` Updated time.Time `json:"updated" bson:"updated"` }
AlertType ...
type Entry ¶
type Entry struct { ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"` Title string `json:"title" bson:"title" validate:"required"` Description string `json:"description" bson:"description" validate:"required"` UploadedBy interface{} `json:"uploadedBy" bson:"uploadedBy"` ContentURL string `json:"contentURL" bson:"contentURL" validate:"required"` ContentType string `json:"contentType" bson:"contentType" validate:"required"` Location Location `json:"location" bson:"location" validate:"required"` Address *geo.Address `json:"address" bson:"address"` AlertType primitive.ObjectID `json:"alertType" bson:"alertType"` Status string `json:"status" bson:"status"` Created time.Time `json:"created" bson:"created"` Updated time.Time `json:"updated" bson:"updated"` }
type LocationRanking ¶
type LocationRanking struct { Average float64 `json:"average" bson:"average"` Text string `json:"text" bson:"text"` NumIncidents int32 `json:"numIncidents" bson:"numIncidents"` }
LocationRanking ...
type Ranking ¶
type Ranking struct { Rank int `json:"rank" bson:"rank"` IsTopAlpha bool `json:"isTopAlpha" bson:"isTopAlpha"` NumIncidents int32 `json:"numIncidents" bson:"numIncidents"` // only relevant if the user is the top alpha LastUpdated time.Time `json:"lastUpdated" bson:"lastUpdated"` }
Ranking ...
type User ¶
type User struct { ID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"` Username string `json:"username" bson:"username" validate:"required"` Email string `json:"email" bson:"email" validate:"required,email"` Password string `json:"password,omitempty" bson:"password" validate:"required"` IsAdmin bool `json:"isAdmin" bson:"isAdmin"` Ranking Ranking `json:"ranking" bson:"ranking"` AdminRole string `json:"adminRole,omitempty" bson:"adminRole"` // super, standard Status string `json:"status" bson:"status"` Created time.Time `json:"created" bson:"created"` Updated time.Time `json:"updated" bson:"updated"` }
User ...
Click to show internal directories.
Click to hide internal directories.