apiv1

package
v0.0.0-...-1b54efc Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.9.0 DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen version v1.9.0 DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen version v1.9.0 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 Cache

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

func NewCache

func NewCache(deps *CacheDeps) *Cache

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string, value *string) error

func (*Cache) Set

func (c *Cache) Set(ctx context.Context, key string, value *Enity) error

type CacheDeps

type CacheDeps struct {
	Cache *rediscache.Cache
}

type Consume

type Consume struct {
	Code   string `json:"code"`
	SendAt int    `json:"send_at"`
}

type Consumer

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

func NewConsumer

func NewConsumer(deps *ConsumerDeps) *Consumer

func (*Consumer) Consume

func (m *Consumer) Consume(ctx context.Context, data []byte) error

func (*Consumer) Shutdown

func (m *Consumer) Shutdown(ctx context.Context) error

type ConsumerCacherGateway

type ConsumerCacherGateway interface {
	Get(ctx context.Context, key string, value *string) error
	Set(ctx context.Context, key string, value *Enity) error
}

type ConsumerDeps

type ConsumerDeps struct {
	Repository ConsumerRepositoryGateway
	Cache      ConsumerCacherGateway
	Publisher  *rabbitmqpub.Publisher
}

type ConsumerRepositoryGateway

type ConsumerRepositoryGateway interface {
	GetByCode(ctx context.Context, code string) (*Enity, error)
}

type DataResult

type DataResult struct {
	Result *Enity `json:"result,omitempty"`
}

DataResult defines model for DataResult.

type DeleteHandlerParams

type DeleteHandlerParams struct {
	// Hard delete data, if equal true, delete hard
	Hard *bool `json:"hard,omitempty"`
}

DeleteHandlerParams defines parameters for DeleteHandler.

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 Enity

type Enity struct {
	Code      *string   `db:"code" json:"code,omitempty"`
	CreatedAt *NullTime `db:"created_at" json:"created_at,omitempty"`
	DeletedAt *NullTime `db:"deleted_at" json:"deleted_at,omitempty"`
	Id        *int64    `db:"id" json:"id,omitempty"`
	Meta      *NullMeta `db:"meta" json:"meta,omitempty"`
	UpdatedAt *NullTime `db:"updated_at" json:"updated_at,omitempty"`
}

Enity defines model for Enity.

func (*Enity) MarshalBinary

func (e *Enity) MarshalBinary() ([]byte, error)

func (*Enity) UnmarshalBinary

func (e *Enity) UnmarshalBinary(data []byte) error

type ErrorAnsw

type ErrorAnsw struct {
	Error *ErrorAnswBody `json:"error,omitempty"`
}

ErrorAnsw defines model for ErrorAnsw.

type ErrorAnswBody

type ErrorAnswBody struct {
	Code       *string `json:"code,omitempty"`
	Details    *string `json:"details,omitempty"`
	StatusCode *int    `json:"statusCode,omitempty"`
}

ErrorAnswBody defines model for ErrorAnswBody.

type Handler

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

func NewHandler

func NewHandler(deps *HandlerDeps) *Handler

func (*Handler) DeleteHandler

func (a *Handler) DeleteHandler(ec echo.Context, id int64, params DeleteHandlerParams) error

func (*Handler) GetHandler

func (a *Handler) GetHandler(ec echo.Context, id int64) error

func (*Handler) PostHandler

func (a *Handler) PostHandler(ec echo.Context) error

func (*Handler) PostToCacheHandler

func (a *Handler) PostToCacheHandler(ec echo.Context, id int64) error

type HandlerCacheGateway

type HandlerCacheGateway interface {
	Set(ctx context.Context, key string, value *Enity) error
}

type HandlerDeps

type HandlerDeps struct {
	Repository RepositoryGateway
	Cache      HandlerCacheGateway
}

type NullMeta

type NullMeta struct {
	garageTypes.NullMeta
}

func NewNullMeta

func NewNullMeta() *NullMeta

type NullString

type NullString struct {
	garageTypes.NullString
}

func NewNullString

func NewNullString() *NullString

type NullTime

type NullTime struct {
	garageTypes.NullTime
}

func NewNullTime

func NewNullTime() *NullTime

type PostHandlerJSONBody

type PostHandlerJSONBody Enity

PostHandlerJSONBody defines parameters for PostHandler.

type PostHandlerJSONRequestBody

type PostHandlerJSONRequestBody PostHandlerJSONBody

PostHandlerJSONRequestBody defines body for PostHandler for application/json ContentType.

type Publish

type Publish struct {
	Code   string    `json:"code"`
	SendAt time.Time `json:"send_at"`
}

type Repository

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

func NewRepository

func NewRepository(deps *RepositoryDeps) (*Repository, error)

func (*Repository) CreateTest

func (r *Repository) CreateTest(ctx context.Context, data *Enity) (*Enity, error)

func (*Repository) GetByCode

func (r *Repository) GetByCode(ctx context.Context, code string) (*Enity, error)

func (*Repository) GetByID

func (r *Repository) GetByID(ctx context.Context, id int64) (*Enity, error)

func (*Repository) HardDeleteByID

func (r *Repository) HardDeleteByID(ctx context.Context, id int64) error

func (*Repository) SoftDeleteByID

func (r *Repository) SoftDeleteByID(ctx context.Context, id int64) error

type RepositoryDeps

type RepositoryDeps struct {
	Conn *pq.Enity
}

type RepositoryGateway

type RepositoryGateway interface {
	CreateTest(ctx context.Context, data *Enity) (*Enity, error)
	GetByID(ctx context.Context, id int64) (data *Enity, err error)
	GetByCode(ctx context.Context, code string) (data *Enity, err error)
	HardDeleteByID(ctx context.Context, id int64) (err error)
	SoftDeleteByID(ctx context.Context, id int64) (err error)
}

type ResultAnsw

type ResultAnsw struct {
	Result *string `json:"result,omitempty"`
}

ResultAnsw defines model for ResultAnsw.

type ServerInterface

type ServerInterface interface {
	// This handler create new data
	// (POST /test)
	PostHandler(ctx echo.Context) error
	// This handler deletes data for requested ID
	// (DELETE /test/{id})
	DeleteHandler(ctx echo.Context, id int64, params DeleteHandlerParams) error
	// This handler getting data for requested ID
	// (GET /test/{id})
	GetHandler(ctx echo.Context, id int64) error
	// This handler put data to cache for requested ID
	// (POST /test/{id})
	PostToCacheHandler(ctx echo.Context, id int64) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) DeleteHandler

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

DeleteHandler converts echo context to params.

func (*ServerInterfaceWrapper) GetHandler

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

GetHandler converts echo context to params.

func (*ServerInterfaceWrapper) PostHandler

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

PostHandler converts echo context to params.

func (*ServerInterfaceWrapper) PostToCacheHandler

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

PostToCacheHandler converts echo context to params.

Jump to

Keyboard shortcuts

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