Back to godoc.org
github.com/DevMine/api-server/srv/context

package context

v0.0.0 (d26fc85)
Latest Go to latest
Published: May 2, 2015 | License: BSD-3-Clause | Module: github.com/DevMine/api-server

Overview

Package context creates a context to pass to each api-server route handlers functions.

Index

type Context

type Context struct {
	// DB is an active connection to the database.
	DB *sql.DB

	// SinceID corresponds to an ID since which to show results.
	SinceID uint64

	// PerPage corresponds to the number of results to show per page.
	PerPage uint64

	// PageNumber shall be used to paginate results when necessary.
	PageNumber uint64
}

Context represents a context of a query to the API server that is meant to be used by route handlers functions.

func NewContext

func NewContext(db *sql.DB, r *http.Request) (*Context, error)

NewContext initializes a Context structure.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier