server

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package server provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.11.1-0.20221010081618-45eb6bdf117a DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type CreateTable200JSONResponse

type CreateTable200JSONResponse Info

func (CreateTable200JSONResponse) VisitCreateTableResponse

func (response CreateTable200JSONResponse) VisitCreateTableResponse(w http.ResponseWriter) error

type CreateTableJSONRequestBody

type CreateTableJSONRequestBody = TableSchema

CreateTableJSONRequestBody defines body for CreateTable for application/json ContentType.

type CreateTableRequestObject

type CreateTableRequestObject struct {
	Body *CreateTableJSONRequestBody
}

type CreateTableResponseObject

type CreateTableResponseObject interface {
	VisitCreateTableResponse(w http.ResponseWriter) error
}

type CreateTabledefaultJSONResponse

type CreateTabledefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (CreateTabledefaultJSONResponse) VisitCreateTableResponse

func (response CreateTabledefaultJSONResponse) VisitCreateTableResponse(w http.ResponseWriter) error

type DbSchema

type DbSchema = []TableSchema

DbSchema defines model for DbSchema.

type DbSchema200JSONResponse

type DbSchema200JSONResponse DbSchema

func (DbSchema200JSONResponse) VisitDbSchemaResponse

func (response DbSchema200JSONResponse) VisitDbSchemaResponse(w http.ResponseWriter) error

type DbSchemaRequestObject

type DbSchemaRequestObject struct {
}

type DbSchemaResponseObject

type DbSchemaResponseObject interface {
	VisitDbSchemaResponse(w http.ResponseWriter) error
}

type DbSchemadefaultJSONResponse

type DbSchemadefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (DbSchemadefaultJSONResponse) VisitDbSchemaResponse

func (response DbSchemadefaultJSONResponse) VisitDbSchemaResponse(w http.ResponseWriter) error

type DeleteDuplicateRows200JSONResponse

type DeleteDuplicateRows200JSONResponse Info

func (DeleteDuplicateRows200JSONResponse) VisitDeleteDuplicateRowsResponse

func (response DeleteDuplicateRows200JSONResponse) VisitDeleteDuplicateRowsResponse(w http.ResponseWriter) error

type DeleteDuplicateRowsRequestObject

type DeleteDuplicateRowsRequestObject struct {
	Name string `json:"name"`
}

type DeleteDuplicateRowsResponseObject

type DeleteDuplicateRowsResponseObject interface {
	VisitDeleteDuplicateRowsResponse(w http.ResponseWriter) error
}

type DeleteDuplicateRowsdefaultJSONResponse

type DeleteDuplicateRowsdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (DeleteDuplicateRowsdefaultJSONResponse) VisitDeleteDuplicateRowsResponse

func (response DeleteDuplicateRowsdefaultJSONResponse) VisitDeleteDuplicateRowsResponse(w http.ResponseWriter) error

type DeleteRows200JSONResponse

type DeleteRows200JSONResponse Info

func (DeleteRows200JSONResponse) VisitDeleteRowsResponse

func (response DeleteRows200JSONResponse) VisitDeleteRowsResponse(w http.ResponseWriter) error

type DeleteRowsJSONRequestBody

type DeleteRowsJSONRequestBody = Row

DeleteRowsJSONRequestBody defines body for DeleteRows for application/json ContentType.

type DeleteRowsRequestObject

type DeleteRowsRequestObject struct {
	Name string `json:"name"`
	Body *DeleteRowsJSONRequestBody
}

type DeleteRowsResponseObject

type DeleteRowsResponseObject interface {
	VisitDeleteRowsResponse(w http.ResponseWriter) error
}

type DeleteRowsdefaultJSONResponse

type DeleteRowsdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (DeleteRowsdefaultJSONResponse) VisitDeleteRowsResponse

func (response DeleteRowsdefaultJSONResponse) VisitDeleteRowsResponse(w http.ResponseWriter) error

type DeleteTable200JSONResponse

type DeleteTable200JSONResponse Info

func (DeleteTable200JSONResponse) VisitDeleteTableResponse

func (response DeleteTable200JSONResponse) VisitDeleteTableResponse(w http.ResponseWriter) error

type DeleteTableRequestObject

type DeleteTableRequestObject struct {
	Name string `json:"name"`
}

type DeleteTableResponseObject

type DeleteTableResponseObject interface {
	VisitDeleteTableResponse(w http.ResponseWriter) error
}

type DeleteTabledefaultJSONResponse

type DeleteTabledefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (DeleteTabledefaultJSONResponse) VisitDeleteTableResponse

func (response DeleteTabledefaultJSONResponse) VisitDeleteTableResponse(w http.ResponseWriter) error

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type Error

type Error struct {
	Message string `json:"message"`
}

Error defines model for Error.

type Info

type Info struct {
	Message string `json:"message"`
}

Info defines model for Info.

type InsertRows200JSONResponse

type InsertRows200JSONResponse Info

func (InsertRows200JSONResponse) VisitInsertRowsResponse

func (response InsertRows200JSONResponse) VisitInsertRowsResponse(w http.ResponseWriter) error

type InsertRowsJSONRequestBody

type InsertRowsJSONRequestBody = Rows

InsertRowsJSONRequestBody defines body for InsertRows for application/json ContentType.

type InsertRowsRequestObject

type InsertRowsRequestObject struct {
	Name string `json:"name"`
	Body *InsertRowsJSONRequestBody
}

type InsertRowsResponseObject

type InsertRowsResponseObject interface {
	VisitInsertRowsResponse(w http.ResponseWriter) error
}

type InsertRowsdefaultJSONResponse

type InsertRowsdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (InsertRowsdefaultJSONResponse) VisitInsertRowsResponse

func (response InsertRowsdefaultJSONResponse) VisitInsertRowsResponse(w http.ResponseWriter) error

type Row

type Row map[string]interface{}

Row defines model for Row.

type RowNames

type RowNames = []string

RowNames defines model for RowNames.

type Rows

type Rows = []Row

Rows defines model for Rows.

type Schema

type Schema struct {
	Column string     `json:"column"`
	Type   SchemaType `json:"type"`
}

Schema defines model for Schema.

type SchemaType

type SchemaType string

SchemaType defines model for Schema.Type.

const (
	Char    SchemaType = "char"
	Image   SchemaType = "image"
	Integer SchemaType = "integer"
	Real    SchemaType = "real"
	RealInv SchemaType = "realInv"
	String  SchemaType = "string"
)

Defines values for SchemaType.

type SelectBody

type SelectBody struct {
	Columns    RowNames `json:"columns"`
	Conditions Row      `json:"conditions"`
}

SelectBody defines model for SelectBody.

type SelectRows200JSONResponse

type SelectRows200JSONResponse Rows

func (SelectRows200JSONResponse) VisitSelectRowsResponse

func (response SelectRows200JSONResponse) VisitSelectRowsResponse(w http.ResponseWriter) error

type SelectRowsJSONRequestBody

type SelectRowsJSONRequestBody = SelectBody

SelectRowsJSONRequestBody defines body for SelectRows for application/json ContentType.

type SelectRowsRequestObject

type SelectRowsRequestObject struct {
	Name string `json:"name"`
	Body *SelectRowsJSONRequestBody
}

type SelectRowsResponseObject

type SelectRowsResponseObject interface {
	VisitSelectRowsResponse(w http.ResponseWriter) error
}

type SelectRowsdefaultJSONResponse

type SelectRowsdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (SelectRowsdefaultJSONResponse) VisitSelectRowsResponse

func (response SelectRowsdefaultJSONResponse) VisitSelectRowsResponse(w http.ResponseWriter) error

type ServerInterface

type ServerInterface interface {

	// (GET /.schema)
	DbSchema(ctx echo.Context) error

	// (POST /delete-table/{name}/)
	DeleteTable(ctx echo.Context, name string) error

	// (POST /table)
	CreateTable(ctx echo.Context) error

	// (PATCH /table/{name})
	UpdateRows(ctx echo.Context, name string) error

	// (POST /table/{name})
	InsertRows(ctx echo.Context, name string) error

	// (POST /table/{name}/delete)
	DeleteRows(ctx echo.Context, name string) error

	// (POST /table/{name}/remove-duplicates)
	DeleteDuplicateRows(ctx echo.Context, name string) error

	// (POST /table/{name}/select)
	SelectRows(ctx echo.Context, name string) error
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) CreateTable

func (w *ServerInterfaceWrapper) CreateTable(ctx echo.Context) error

CreateTable converts echo context to params.

func (*ServerInterfaceWrapper) DbSchema

func (w *ServerInterfaceWrapper) DbSchema(ctx echo.Context) error

DbSchema converts echo context to params.

func (*ServerInterfaceWrapper) DeleteDuplicateRows

func (w *ServerInterfaceWrapper) DeleteDuplicateRows(ctx echo.Context) error

DeleteDuplicateRows converts echo context to params.

func (*ServerInterfaceWrapper) DeleteRows

func (w *ServerInterfaceWrapper) DeleteRows(ctx echo.Context) error

DeleteRows converts echo context to params.

func (*ServerInterfaceWrapper) DeleteTable

func (w *ServerInterfaceWrapper) DeleteTable(ctx echo.Context) error

DeleteTable converts echo context to params.

func (*ServerInterfaceWrapper) InsertRows

func (w *ServerInterfaceWrapper) InsertRows(ctx echo.Context) error

InsertRows converts echo context to params.

func (*ServerInterfaceWrapper) SelectRows

func (w *ServerInterfaceWrapper) SelectRows(ctx echo.Context) error

SelectRows converts echo context to params.

func (*ServerInterfaceWrapper) UpdateRows

func (w *ServerInterfaceWrapper) UpdateRows(ctx echo.Context) error

UpdateRows converts echo context to params.

type StrictHandlerFunc

type StrictHandlerFunc func(ctx echo.Context, args interface{}) (interface{}, error)

type StrictMiddlewareFunc

type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc

type StrictServerInterface

type StrictServerInterface interface {

	// (GET /.schema)
	DbSchema(ctx context.Context, request DbSchemaRequestObject) (DbSchemaResponseObject, error)

	// (POST /delete-table/{name}/)
	DeleteTable(ctx context.Context, request DeleteTableRequestObject) (DeleteTableResponseObject, error)

	// (POST /table)
	CreateTable(ctx context.Context, request CreateTableRequestObject) (CreateTableResponseObject, error)

	// (PATCH /table/{name})
	UpdateRows(ctx context.Context, request UpdateRowsRequestObject) (UpdateRowsResponseObject, error)

	// (POST /table/{name})
	InsertRows(ctx context.Context, request InsertRowsRequestObject) (InsertRowsResponseObject, error)

	// (POST /table/{name}/delete)
	DeleteRows(ctx context.Context, request DeleteRowsRequestObject) (DeleteRowsResponseObject, error)

	// (POST /table/{name}/remove-duplicates)
	DeleteDuplicateRows(ctx context.Context, request DeleteDuplicateRowsRequestObject) (DeleteDuplicateRowsResponseObject, error)

	// (POST /table/{name}/select)
	SelectRows(ctx context.Context, request SelectRowsRequestObject) (SelectRowsResponseObject, error)
}

StrictServerInterface represents all server handlers.

type TableSchema

type TableSchema struct {
	Schema    *[]Schema `json:"schema,omitempty"`
	TableName *string   `json:"tableName,omitempty"`
}

TableSchema defines model for TableSchema.

type UpdateBody

type UpdateBody struct {
	Conditions Row `json:"conditions"`
	Data       Row `json:"data"`
}

UpdateBody defines model for UpdateBody.

type UpdateRows200JSONResponse

type UpdateRows200JSONResponse Info

func (UpdateRows200JSONResponse) VisitUpdateRowsResponse

func (response UpdateRows200JSONResponse) VisitUpdateRowsResponse(w http.ResponseWriter) error

type UpdateRowsJSONRequestBody

type UpdateRowsJSONRequestBody = UpdateBody

UpdateRowsJSONRequestBody defines body for UpdateRows for application/json ContentType.

type UpdateRowsRequestObject

type UpdateRowsRequestObject struct {
	Name string `json:"name"`
	Body *UpdateRowsJSONRequestBody
}

type UpdateRowsResponseObject

type UpdateRowsResponseObject interface {
	VisitUpdateRowsResponse(w http.ResponseWriter) error
}

type UpdateRowsdefaultJSONResponse

type UpdateRowsdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (UpdateRowsdefaultJSONResponse) VisitUpdateRowsResponse

func (response UpdateRowsdefaultJSONResponse) VisitUpdateRowsResponse(w http.ResponseWriter) error

Jump to

Keyboard shortcuts

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