Documentation
¶
Overview ¶
Package openapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.
Package openapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func NewCreateItemParams(r PostItemsRequest) db.CreateItemParams
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type ChiServerOptions
- type ErrorResponse
- type GetItemResponse
- type GetItemsParams
- type GetItemsResponse
- type Id
- type Item
- type ItemId
- type Limit
- type MiddlewareFunc
- type Page
- type PatchItemJSONRequestBody
- type PatchItemRequest
- type PostItemsJSONRequestBody
- type PostItemsRequest
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) DeleteItem(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetItemById(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetItems(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PatchItem(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostItems(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
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 Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
func NewCreateItemParams ¶
func NewCreateItemParams(r PostItemsRequest) db.CreateItemParams
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct {
BaseURL string
BaseRouter chi.Router
Middlewares []MiddlewareFunc
}
type ErrorResponse ¶
type ErrorResponse struct {
// HTTP status code
Code int64 `json:"code"`
// Error message
Message string `json:"message"`
}
ErrorResponse defines model for errorResponse.
type GetItemsParams ¶
type GetItemsParams struct {
// ページ数
Limit *Limit `json:"limit,omitempty"`
// 閲覧ページ
Page *Page `json:"page,omitempty"`
}
GetItemsParams defines parameters for GetItems.
func (GetItemsParams) ToDbParams ¶
func (p GetItemsParams) ToDbParams() db.ListItemsParams
type GetItemsResponse ¶
type GetItemsResponse struct {
Items []Item `json:"items"`
}
GetItemsResponse defines model for getItemsResponse.
type Item ¶
type Item struct {
// 商品コード
Code string `json:"code"`
// 原価
Cost float32 `json:"cost"`
// 作成日時
CreatedAt time.Time `json:"created_at"`
// 主キー型
Id Id `json:"id"`
// 商品名
Name string `json:"name"`
// 単位
Unit string `json:"unit"`
// 更新日時
UpdatedAt time.Time `json:"updated_at"`
}
商品モデル
type MiddlewareFunc ¶
type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc
type PatchItemJSONRequestBody ¶
type PatchItemJSONRequestBody PatchItemRequest
PatchItemJSONRequestBody defines body for PatchItem for application/json ContentType.
type PatchItemRequest ¶
type PatchItemRequest struct {
// 商品モデル
Value Item `json:"value"`
}
PatchItemRequest defines model for patchItemRequest.
type PostItemsJSONRequestBody ¶
type PostItemsJSONRequestBody PostItemsRequest
PostItemsJSONRequestBody defines body for PostItems for application/json ContentType.
type PostItemsRequest ¶
type PostItemsRequest struct {
Value *struct {
Code string `json:"code"`
Cost float32 `json:"cost"`
Name string `json:"name"`
Unit string `json:"unit"`
} `json:"value,omitempty"`
}
商品登録時の商品情報
type ServerInterface ¶
type ServerInterface interface {
// Get item list
// (GET /items)
GetItems(w http.ResponseWriter, r *http.Request, params GetItemsParams)
// Create Item
// (POST /items)
PostItems(w http.ResponseWriter, r *http.Request)
// Delete item
// (DELETE /items/{item_id})
DeleteItem(w http.ResponseWriter, r *http.Request, itemId ItemId)
// Get Item
// (GET /items/{item_id})
GetItemById(w http.ResponseWriter, r *http.Request, itemId ItemId)
// Update item
// (PATCH /items/{item_id})
PatchItem(w http.ResponseWriter, r *http.Request, itemId ItemId)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) DeleteItem ¶
func (siw *ServerInterfaceWrapper) DeleteItem(w http.ResponseWriter, r *http.Request)
DeleteItem operation middleware
func (*ServerInterfaceWrapper) GetItemById ¶
func (siw *ServerInterfaceWrapper) GetItemById(w http.ResponseWriter, r *http.Request)
GetItemById operation middleware
func (*ServerInterfaceWrapper) GetItems ¶
func (siw *ServerInterfaceWrapper) GetItems(w http.ResponseWriter, r *http.Request)
GetItems operation middleware
func (*ServerInterfaceWrapper) PatchItem ¶
func (siw *ServerInterfaceWrapper) PatchItem(w http.ResponseWriter, r *http.Request)
PatchItem operation middleware
func (*ServerInterfaceWrapper) PostItems ¶
func (siw *ServerInterfaceWrapper) PostItems(w http.ResponseWriter, r *http.Request)
PostItems operation middleware