api-server: github.com/DevMine/api-server/srv/context Index | Files

package context

import "github.com/DevMine/api-server/srv/context"

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


Package Files


type Context Uses

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 Uses

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

NewContext initializes a Context structure.

Package context imports 4 packages (graph) and is imported by 7 packages. Updated 2016-08-02. Refresh now. Tools for package owners.