server

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeListRequest

func DecodeListRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeListRequest returns a decoder for requests sent to the Tables List endpoint.

func EncodeListResponse

func EncodeListResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeListResponse returns an encoder for responses returned by the Tables List endpoint.

func ListTablesPath

func ListTablesPath() string

ListTablesPath returns the URL path to the Tables service List HTTP endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the Tables endpoints.

func MountListHandler

func MountListHandler(mux goahttp.Muxer, h http.Handler)

MountListHandler configures the mux to serve the "Tables" service "List" endpoint.

func NewListHandler

func NewListHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewListHandler creates a HTTP handler which loads the HTTP request and calls the "Tables" service "List" endpoint.

func NewListPayload

func NewListPayload(schema string) *tables.ListPayload

NewListPayload builds a Tables service List endpoint payload.

Types

type ErrorNamer

type ErrorNamer interface {
	ErrorName() string
}

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type ListResponseBody

type ListResponseBody []*TableResponse

ListResponseBody is the type of the "Tables" service "List" endpoint HTTP response body.

func NewListResponseBody

func NewListResponseBody(res []*tables.Table) ListResponseBody

NewListResponseBody builds the HTTP response body from the result of the "List" endpoint of the "Tables" service.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type Server

type Server struct {
	Mounts []*MountPoint
	List   http.Handler
}

Server lists the Tables service endpoint HTTP handlers.

func New

func New(
	e *tables.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the Tables service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

type TableResponse

type TableResponse struct {
	// Postgres table schema
	Schema string `form:"schema" json:"schema" xml:"schema"`
	// Postgres table name
	Name string `form:"name" json:"name" xml:"name"`
	// Table row estimate, using pg_stats
	ApproximateRowCount int64 `form:"approximate_row_count" json:"approximate_row_count" xml:"approximate_row_count"`
	// Status of the publication, set to active when table is streaming
	PublicationStatus string `form:"publication_status" json:"publication_status" xml:"publication_status"`
	// Status of table imports
	ImportStatus string `form:"import_status" json:"import_status" xml:"import_status"`
	// Last active import rows processed total
	ImportRowsProcessedTotal int64 `form:"import_rows_processed_total" json:"import_rows_processed_total" xml:"import_rows_processed_total"`
}

TableResponse is used to define fields on response body types.

Jump to

Keyboard shortcuts

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