http

package
v0.7.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

You can use the "packr clean" command to clean up this, and any other packr generated files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS added in v0.6.1

func CORSFunc added in v0.6.1

func CORSFunc(w http.ResponseWriter, req *http.Request, params httprouter.Params)

func GetQueryShape

func GetQueryShape(q string, ses query.HTTP) ([]byte, error)

func LogRequest

func LogRequest(handler httprouter.Handle) httprouter.Handle

func ParseJSONToQuadList

func ParseJSONToQuadList(jsonBody []byte) (out []quad.Quad, _ error)

func SetupRoutes

func SetupRoutes(handle *graph.Handle, cfg *Config) error

func WriteError added in v0.7.0

func WriteError(w io.Writer, err error) error

func WriteResult added in v0.7.0

func WriteResult(w io.Writer, result interface{}) error

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func (*API) APIv1

func (api *API) APIv1(r *httprouter.Router)

func (*API) GetHandleForRequest

func (api *API) GetHandleForRequest(r *http.Request) (*graph.Handle, error)

func (*API) RWOnly added in v0.6.1

func (api *API) RWOnly(handler httprouter.Handle) httprouter.Handle

func (*API) ServeV1Delete

func (api *API) ServeV1Delete(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (*API) ServeV1Query

func (api *API) ServeV1Query(w http.ResponseWriter, r *http.Request, params httprouter.Params)

TODO(barakmich): Turn this into proper middleware.

func (*API) ServeV1Shape

func (api *API) ServeV1Shape(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (*API) ServeV1Write

func (api *API) ServeV1Write(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (*API) ServeV1WriteNQuad

func (api *API) ServeV1WriteNQuad(w http.ResponseWriter, r *http.Request, params httprouter.Params)

type Config added in v0.7.0

type Config struct {
	ReadOnly bool
	Timeout  time.Duration
	Batch    int
}

type ErrorQueryWrapper

type ErrorQueryWrapper struct {
	Error string `json:"error"`
}

type SuccessQueryWrapper

type SuccessQueryWrapper struct {
	Result interface{} `json:"result"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL