Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateHero ¶
type CreateHero struct {
Name string `bson:"name" json:"name"`
SuperPowers []string `bson:"superpowers" json:"superpowers"`
Gender string `bson:"gender" json:"gender"`
Metadata `bson:",inline"`
}
CreateHero holds values for creating users.
type Filters ¶
type Filters struct {
SuperPowers []string `form:"superpowers" json:"superpowers" query:"superpowers"`
}
Filters represent restrictions that can be applied when listing heroes.
type Hero ¶
type Hero struct {
ID bson.ObjectId `bson:"_id" json:"id"`
Name string `bson:"name" json:"name"`
SuperPowers []string `bson:"superpowers" json:"superpowers"`
Gender string `bson:"gender" json:"gender"`
Metadata `bson:",inline"`
}
Hero holds value for /v1/heroes endpoint
type ListResults ¶
type ListResults struct {
Heroes []Hero `json:"items"`
Count int `json:"count"`
Total int `json:"total"`
PreviousIndex *int `json:"previousIndex,omitempty"`
Index int `json:"index"`
NextIndex *int `json:"nextIndex,omitempty"`
}
ListResults holds a list of heroes and pagination information.
func List ¶
func List(dbConn *database.DB, filters Filters, paging pagination.Paging) (*ListResults, error)
List returns a list of heroes from the database and applies query string parameters
type Metadata ¶
type Metadata struct {
Created time.Time `bson:"created" json:"created"`
LastModified time.Time `bson:"lastModified" json:"lastModified"`
IsRemoved bool `bson:"isRemoved" json:"-"`
}
Metadata fields for a hero
type UpdateHero ¶
type UpdateHero CreateHero
UpdateHero is what we accept from users to update a Hero record.
Click to show internal directories.
Click to hide internal directories.