Documentation ¶
Index ¶
- Variables
- func Error(w http.ResponseWriter, err error, code int)
- func HandleIDRoute(w http.ResponseWriter, r *http.Request, selectClause query.Clauser, ...)
- func HandleRoute(w http.ResponseWriter, r *http.Request, query query.Clauser, ...)
- func IgnoreClause(r *http.Request, table string) query.Clauser
- func InClause(r *http.Request, column string) query.Clauser
- func InternalError(w http.ResponseWriter, err error)
- func LimitClause(r *http.Request) query.Clauser
- func MaybeQueryInt(r *http.Request, key string) (bool, int)
- func QueryInt(r *http.Request, key string, defaultValue int) int
- func SearchClause(r *http.Request) query.Clauser
- type QueryBuilderFunc
- type RowTranslatorFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var Db *sql.DB
Db is the global database connection
Functions ¶
func HandleIDRoute ¶
func HandleIDRoute(w http.ResponseWriter, r *http.Request, selectClause query.Clauser, rowTranslator RowTranslatorFunc, table string)
HandleIDRoute creates a handler function for ID routes
func HandleRoute ¶
func HandleRoute(w http.ResponseWriter, r *http.Request, query query.Clauser, rowTranslator RowTranslatorFunc)
HandleRoute responds to queries
func IgnoreClause ¶
IgnoreClause sets up the query to reject certain IDs from the response
func InternalError ¶
func InternalError(w http.ResponseWriter, err error)
InternalError sends an internal server error message
func LimitClause ¶
LimitClause creates a limit clause from the request
func MaybeQueryInt ¶
MaybeQueryInt gets an integer value if available
Types ¶
type QueryBuilderFunc ¶
QueryBuilderFunc creates a query for the HTTP request
type RowTranslatorFunc ¶
RowTranslatorFunc creates a row of JSON response from a database row
Click to show internal directories.
Click to hide internal directories.