common

package
v0.0.0-...-fa1582b Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(err error, w http.ResponseWriter)

func GetLatestVersion

func GetLatestVersion(protos []*protobuf.Protobuf) (latest *protobuf.Protobuf)

func GetName

func GetName(r *http.Request) string

func GetVersion

func GetVersion(r *http.Request) string

func GetVersionFromProtoSlice

func GetVersionFromProtoSlice(protos []*protobuf.Protobuf, version string) (*protobuf.Protobuf, error)

func NotFound

func NotFound(err error, w http.ResponseWriter)

func ParseNameVersionExtString

func ParseNameVersionExtString(in, ext string) (string, string)

func ServeFile

func ServeFile(w http.ResponseWriter, r *http.Request, name string, rdr io.ReadSeeker)

func SortVersions

func SortVersions(protos []*protobuf.Protobuf) (sorted []*protobuf.Protobuf)

func UnmarshallInto

func UnmarshallInto(body io.Reader, obj interface{}) error

func WriteJSONResponse

func WriteJSONResponse(res interface{}, w http.ResponseWriter)

func WriteRawResponse

func WriteRawResponse(out []byte, w http.ResponseWriter)

Types

type CatchAllHandler

type CatchAllHandler struct {
	http.Handler
}

func NewCatchAllHandler

func NewCatchAllHandler() *CatchAllHandler

func (*CatchAllHandler) ServeHTTP

func (c *CatchAllHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ServerController

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

func (*ServerController) DB

func (*ServerController) SetDBEngine

func (s *ServerController) SetDBEngine(db dbcommon.DBEngine)

func (*ServerController) SetStorageProvider

func (s *ServerController) SetStorageProvider(storage storagecommon.Provider)

func (*ServerController) Storage

type ServerError

type ServerError struct {
	ErrMsg string `json:"error"`
}

func (*ServerError) Error

func (e *ServerError) Error() string

func (*ServerError) JSON

func (e *ServerError) JSON() string

Jump to

Keyboard shortcuts

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