apigateway

package
v0.0.141 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Types
	HANDLER   = "HANDLER"
	HTTP      = "HTTP"
	REST      = "REST"
	WEBSOCKET = "WEBSOCKET"
	// Methods
	CONNECT = "CONNECT"
	DELETE  = "DELETE"
	GET     = "GET"
	HEAD    = "HEAD"
	OPTIONS = "OPTIONS"
	PATCH   = "PATCH"
	POST    = "POST"
	PUT     = "PUT"
	TRACE   = "TRACE"
)

Variables

View Source
var Company = envar.EnvarStr("", "COMPANY")
View Source
var DefaultTelemetry func(next http.Handler) http.Handler
View Source
var Host = strs.Format(`%s:%d`, envar.EnvarStr("http://localhost", "HOST"), envar.EnvarInt(3300, "PORT"))
View Source
var HostName, _ = os.Hostname()
View Source
var PackageName = "apigateway"
View Source
var PackagePath = "/api/apigateway"
View Source
var PackageTitle = envar.EnvarStr("Apigateway", "PACKAGE_TITLE")
View Source
var PackageVersion = envar.EnvarStr("0.0.1", "VERSION")
View Source
var Web = envar.EnvarStr("", "WEB")

Functions

func Banner()

func Version added in v0.0.123

func Version() et.Json

Types

type Handlers added in v0.0.126

type Handlers map[string]http.HandlerFunc

type HttpServer added in v0.0.123

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

func (*HttpServer) AddHandleMethod added in v0.0.138

func (s *HttpServer) AddHandleMethod(method, path string, handlerFn http.HandlerFunc, packageName string)

func (*HttpServer) AddRoute added in v0.0.138

func (s *HttpServer) AddRoute(method, path, resolve, kind, stage, packageName string)

Add a route to the list

func (*HttpServer) Connect added in v0.0.126

func (s *HttpServer) Connect(pattern string, handlerFn http.HandlerFunc, packageName string)

Connect adds the route `pattern` that matches `CONNECT` http method to

func (*HttpServer) Delete added in v0.0.126

func (s *HttpServer) Delete(pattern string, handlerFn http.HandlerFunc, packageName string)

Delete adds the route `pattern` that matches `DELETE` http method to

func (*HttpServer) Get added in v0.0.126

func (s *HttpServer) Get(pattern string, handlerFn http.HandlerFunc, packageName string)

Get adds the route `pattern` that matches `GET` http method to

func (*HttpServer) GetResolve added in v0.0.138

func (s *HttpServer) GetResolve(method, path string) *Resolve

Get a route from the list

func (*HttpServer) Handler added in v0.0.123

func (s *HttpServer) Handler(handlerFn http.HandlerFunc)

Handler sets the handler function for the server.

func (*HttpServer) HandlerWebSocket added in v0.0.123

func (s *HttpServer) HandlerWebSocket(handlerFn http.HandlerFunc)

HandlerWebSocket sets the handler function for the server.

func (*HttpServer) Head added in v0.0.126

func (s *HttpServer) Head(pattern string, handlerFn http.HandlerFunc, packageName string)

Head adds the route `pattern` that matches `HEAD` http method to

func (*HttpServer) LoadRouter added in v0.0.138

func (s *HttpServer) LoadRouter() error

Load routes from file

func (*HttpServer) MethodFunc added in v0.0.126

func (s *HttpServer) MethodFunc(method, pattern string, handlerFn http.HandlerFunc, packageName string)

MethodFunc adds the route `pattern` that matches `method` http method to execute the `handlerFn` http.HandlerFunc.

func (*HttpServer) NotFound added in v0.0.123

func (s *HttpServer) NotFound(handlerFn http.HandlerFunc)

NotFound sets the handler function for the server.

func (*HttpServer) Options added in v0.0.126

func (s *HttpServer) Options(pattern string, handlerFn http.HandlerFunc, packageName string)

Options adds the route `pattern` that matches `OPTIONS` http method to

func (*HttpServer) Patch added in v0.0.126

func (s *HttpServer) Patch(pattern string, handlerFn http.HandlerFunc, packageName string)

Patch adds the route `pattern` that matches `PATCH` http method to

func (*HttpServer) Post added in v0.0.126

func (s *HttpServer) Post(pattern string, handlerFn http.HandlerFunc, packageName string)

Post adds the route `pattern` that matches `POST` http method to

func (*HttpServer) Put added in v0.0.126

func (s *HttpServer) Put(pattern string, handlerFn http.HandlerFunc, packageName string)

Put adds the route `pattern` that matches `PUT` http method to

func (*HttpServer) Save added in v0.0.138

func (s *HttpServer) Save() error

Save routes to file

func (*HttpServer) Trace added in v0.0.126

func (s *HttpServer) Trace(pattern string, handlerFn http.HandlerFunc, packageName string)

Trace adds the route `pattern` that matches `TRACE` http method to

type Metrics added in v0.0.126

type Metrics struct {
	ReqID            string
	TimeBegin        time.Time
	TimeEnd          time.Time
	TimeExec         time.Time
	SearchTime       time.Duration
	ResponseTime     time.Duration
	Downtime         time.Duration
	Latency          time.Duration
	NotFount         bool
	EndPoint         string
	Method           string
	RemoteAddr       string
	HostName         string
	Proto            string
	MTotal           uint64
	MUsed            uint64
	MFree            uint64
	PFree            float64
	RequestsHost     Request
	RequestsEndpoint Request
	Scheme           string
}

func NewMetric added in v0.0.127

func NewMetric(r *http.Request) *Metrics

type Node

type Node struct {
	Tag     string
	Resolve et.Json
	Nodes   []*Node
	// contains filtered or unexported fields
}

type Nodes added in v0.0.123

type Nodes struct {
	Routes []*Node
}

type Pakage added in v0.0.123

type Pakage struct {
	Name  string
	Nodes []*Node
	Count int
}

type Pakages added in v0.0.123

type Pakages struct {
	Pakages []*Pakage
}

type Request added in v0.0.126

type Request struct {
	Tag     string
	Day     int
	Hour    int
	Minute  int
	Seccond int
	Limit   int
}

func CallRequests added in v0.0.126

func CallRequests(tag string) Request

type Resolute added in v0.0.123

type Resolute struct {
	Method     string
	Proto      string
	Path       string
	RawQuery   string
	Query      url.Values
	RequestURI string
	RemoteAddr string
	Header     http.Header
	Body       io.ReadCloser
	Host       string
	Scheme     string
	Resolve    *Resolve
	URL        string
}

func GetResolute added in v0.0.126

func GetResolute(r *http.Request) *Resolute

func (*Resolute) ToString added in v0.0.123

func (r *Resolute) ToString() string

type Resolve added in v0.0.123

type Resolve struct {
	Node    *Node
	Params  []et.Json
	Resolve string
}

type Server added in v0.0.123

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

func New added in v0.0.123

func New() (*Server, error)

func (*Server) Close added in v0.0.123

func (serv *Server) Close() error

func (*Server) Start added in v0.0.123

func (serv *Server) Start()

type Service added in v0.0.123

type Service et.Item

func (*Service) Version added in v0.0.123

func (c *Service) Version(rq []byte, rp *et.Item) error

Jump to

Keyboard shortcuts

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