api

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIN_PORT = 8000
	MAX_PORT = 8100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func NewAPI

func NewAPI(cfg Config) (*API, error)

@host localhost:8000 @BasePath / @schemes http

func (*API) Shutdown

func (s *API) Shutdown(ctx context.Context) error

func (*API) Start

func (s *API) Start() error

func (*API) SubmitJob added in v0.1.7

func (s *API) SubmitJob(ctx context.Context, ji *input.Job) (*tork.Job, error)

type Config

type Config struct {
	Broker     mq.Broker
	DataStore  datastore.Datastore
	Address    string
	Middleware Middleware
	Endpoints  map[string]web.HandlerFunc
	Enabled    map[string]bool
}

type Context

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

func (*Context) Bind

func (c *Context) Bind(i any) error

func (*Context) Done

func (c *Context) Done() <-chan any

func (*Context) Error

func (c *Context) Error(code int, err error)

func (*Context) Get added in v0.1.6

func (c *Context) Get(key string) any

func (*Context) JSON

func (c *Context) JSON(code int, data any) error

func (*Context) NoContent added in v0.1.6

func (c *Context) NoContent(code int) error

func (*Context) Request

func (c *Context) Request() *http.Request

func (*Context) Response added in v0.1.6

func (c *Context) Response() http.ResponseWriter

func (*Context) String

func (c *Context) String(code int, s string) error

type HealthResponse added in v0.1.7

type HealthResponse struct {
	Status string `json:"status"`
}

type Middleware added in v0.1.6

type Middleware struct {
	Web  []web.MiddlewareFunc
	Job  []job.MiddlewareFunc
	Echo []echo.MiddlewareFunc
}

Jump to

Keyboard shortcuts

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