Documentation ¶
Overview ¶
The "author" GET, POST and DELETE response functionality for requests to the /author endpoint. A part of the authors methods for the rest-api-go application. Governed by the license that can be found in the LICENSE file
The "authors" response functionality for requests to the /authors endpoint. A part of the authors methods for the rest-api-go application. Governed by the license that can be found in the LICENSE file
The "health" response functionality for requests to the /health endpoint. A part of the toolbox (utility) methods for the rest-api-go application. Governed by the license that can be found in the LICENSE file
The "quote" GET, POST and DALETE response functionality for requests to the /quote endpoint. A part of the quotes methods for the rest-api-go application. Governed by the license that can be found in the LICENSE file
The "quotes" response functionality for requests to the /quotes endpoint. A part of the quotes methods for the rest-api-go application. Governed by the license that can be found in the LICENSE file
The "ready" response functionality for requests to the /ready endpoint. A part of the toolbox (utility) methods for the rest-api-go application. Governed by the license that can be found in the LICENSE file
The "version" response functionality for requests to the /version endpoint. A part of the toolbox (utility) methods for the rest-api-go application. Governed by the license that can be found in the LICENSE file
Index ¶
- Variables
- func GetHealth(w http.ResponseWriter, r *http.Request)
- func GetVersion(w http.ResponseWriter, r *http.Request)
- type App
- func (a *App) CreateAuthor(w http.ResponseWriter, r *http.Request)
- func (a *App) CreateQuote(w http.ResponseWriter, r *http.Request)
- func (a *App) DeleteAuthor(w http.ResponseWriter, r *http.Request)
- func (a *App) DeleteQuote(w http.ResponseWriter, r *http.Request)
- func (a *App) GetAuthor(w http.ResponseWriter, r *http.Request)
- func (a *App) GetAuthors(w http.ResponseWriter, r *http.Request)
- func (a *App) GetQuote(w http.ResponseWriter, r *http.Request)
- func (a *App) GetQuotes(w http.ResponseWriter, r *http.Request)
- func (a *App) GetReady(w http.ResponseWriter, r *http.Request)
- func (a *App) Initialize(dbUser, dbPassword, dbName, dbHost string)
- func (a *App) Run(dbPort int)
- type Author
- type AuthorMin
- type Health
- type Quote
- type QuoteMin
- type Ready
- type Version
Constants ¶
This section is empty.
Variables ¶
var Authors []Author
var Authorsmin []AuthorMin
var Quotes []Quote
var Quotesmin []QuoteMin
Functions ¶
func GetHealth ¶
func GetHealth(w http.ResponseWriter, r *http.Request)
GetHealth looks up the health of the application. GET /health Returns all of the health status of all the components of the application.
func GetVersion ¶
func GetVersion(w http.ResponseWriter, r *http.Request)
GetVersion looks up the current version of the application. GET /version Returns the current version of the application.
Types ¶
type App ¶
func (*App) CreateAuthor ¶
func (a *App) CreateAuthor(w http.ResponseWriter, r *http.Request)
CreateAuthor creates a new author. POST /author Returns newly created author ID.
func (*App) CreateQuote ¶
func (a *App) CreateQuote(w http.ResponseWriter, r *http.Request)
CreateQuote creates a new quote. Validates that the author ID exists. POST /quote Returns the ID of new quote as a part of the "status" response message.
func (*App) DeleteAuthor ¶
func (a *App) DeleteAuthor(w http.ResponseWriter, r *http.Request)
Delete Author deletes an author by author ID. DELETE /author/{id} Returns a status message that includes the ID of the author record deleted.
func (*App) DeleteQuote ¶
func (a *App) DeleteQuote(w http.ResponseWriter, r *http.Request)
DeleteQuote deletes a quote by quote ID. DELETE /quote/{id} Returns.
func (*App) GetAuthor ¶
func (a *App) GetAuthor(w http.ResponseWriter, r *http.Request)
GetAuthor looks up a specific author by ID. GET /author Looks up a author in the database by ID and returns results JSON format.
func (*App) GetAuthors ¶
func (a *App) GetAuthors(w http.ResponseWriter, r *http.Request)
GetAuthors looks up all of the authors. GET /authors Populates authors slice with all of the author records in the database and returns JSON formatted listing. @todo: exclude author information in quotes list with each author
func (*App) GetQuote ¶
func (a *App) GetQuote(w http.ResponseWriter, r *http.Request)
GetQuote looks up a specific quote by ID. GET /quote/{id} Returns a quote in the JSON format provided the target ID is valid.
func (*App) GetQuotes ¶
func (a *App) GetQuotes(w http.ResponseWriter, r *http.Request)
GetQuotes looks up all of the quotes. GET /quotes Returns all of the quotes in JSON format.
func (*App) GetReady ¶
func (a *App) GetReady(w http.ResponseWriter, r *http.Request)
GetReady determines if the application is ready to process requests. GET /ready Returns the application state to determine if the application is ready to process requests.
func (*App) Initialize ¶
type AuthorMin ¶
type AuthorMin struct { // gorm.Model ID uint `gorm:"primary;key";json:"id"` CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time First string `json:"first,omitempty"` Last string `json:"last,omitempty"` Born time.Time `json:"born,omitempty"` Died time.Time `json:"died,omitempty"` Description string `json:"description,omitempty"` BioLink string `json:"biolink,omitempty"` }
Author type, referenced by core items: quotes, publications, etc.
type QuoteMin ¶
type QuoteMin struct { // gorm.Model ID uint `gorm:"primary;key";json:"id"` CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time Quote string `json:"quote"` AuthorID uint `gorm:"index";json:"authorid"` }
Quote type (more like an object), manages the details of a quote.