gohaltlib

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 20 Imported by: 0

README

gohalt

Gohaltlib 👮‍♀🔧: Gohalt 3rd Party Integrations library

lint report version license godoc

go get -u github.com/1pkg/gohalt go get -u github.com/1pkg/gohaltlib

Note: in gohalt v0.3.0 all integrations were moved to separate gohaltlib repository to make base gohalt repository dependencies footprint small.

Introduction

Gohalt is simple and convenient yet powerful and efficient throttling go library. Gohalt provides various throttlers and surronding tools to build throttling pipelines and rate limiters of any complexity adjusted to your specific needs. Gohalt provides an easy way to integrate throttling and rate limiting with your infrastructure through built in middlewares.

Integrations

Library Adapter
gin func NewMiddlewareGin(thr Throttler, with GinWith, on GinOn) gin.HandlerFunc
stdlib http handler func NewMiddlewareStd(h http.Handler, thr Throttler, with StdWith, on StdOn) http.Handler
echo func NewMiddlewareEcho(thr Throttler, with EchoWith, on EchoOn) echo.MiddlewareFunc
beego func NewMiddlewareBeego(thr Throttler, with BeegoWith, on BeegoOn) beego.FilterFunc
kit func NewMiddlewareKit(thr Throttler, with KitWith, on KitOn) endpoint.Middleware
mux func NewMiddlewareMux(h http.Handler, thr Throttler, with MuxWith, on MuxOn) http.Handler
httprouter func NewMiddlewareRouter(h http.Handler, thr Throttler, with RouterWith, on RouterOn) http.Handler
reveal func NewMiddlewareRevel(thr Throttler, with RevealWith, on RevealOn) revel.Filter
iris func NewMiddlewareIris(thr Throttler, with IrisWith, on IrisOn) iris.Handler
fasthttp func NewMiddlewareFast(h fasthttp.RequestHandler, thr Throttler, with FastWith, on FastOn) fasthttp.RequestHandler
stdlib rt func NewRoundTripperStd(rt http.RoundTripper, thr Throttler, with RoundTripperStdWith, on RoundTripperStdOn) http.RoundTripper
fasthttp rt func NewRoundTripperFast(rt RoundTripperFast, thr Throttler, with RoundTripperFastWith, on RoundTripperFastOn) RoundTripperFast
stdlib rpc client coded func NewRPCClientCodec(cc rpc.ClientCodec, thr Throttler, with RPCCodecWith, on RPCCodecOn) rpc.ClientCodec
stdlib rpc server coded func NewRPCServerCodec(sc rpc.ServerCodec, thr Throttler, with RPCCodecWith, on RPCCodecOn) rpc.ServerCodec
grpc client stream func NewGRPCClientStream(cs grpc.ClientStream, thr Throttler, with GRPCStreamWith, on GRPCStreamOn) grpc.ClientStream
grpc server stream func NewGrpServerStream(ss grpc.ServerStream, thr Throttler, with GRPCStreamWith, on GRPCStreamOn) grpc.ServerStream
go-micro client func NewMicroClient(thr Throttler, with MicroClientWith, on MicroOn) client.Wrapper
go-micro server func NewMicroHandler(thr Throttler, with MicroServerWith, on MicroOn) server.HandlerWrapper
stdlib net conn func NewNetConn(conn net.Conn, thr Throttler, with NetConnWith, on NetConnOn, mode NetConnMode) net.Conn
stdlib sql func NewSQLClient(cli SQLClient, thr Throttler, with SQLClientWith, on SQLClientOn) SQLClient
stdlib io reader func NewReader(r io.Reader, thr Throttler, with RWWith, on RWOn) io.Reader
stdlib io writer func NewWriter(w io.Writer, thr Throttler, with RWWith, on RWOn) io.Writer

Licence

Gohaltlib is licensed under the MIT License.
See LICENSE for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeegoOnAbort

func BeegoOnAbort(bctx *beegoctx.Context, err error)

func BeegoWithIP

func BeegoWithIP(bctx *beegoctx.Context) context.Context

func EchoOnAbort

func EchoOnAbort(ectx echo.Context, err error) error

func EchoWithIP

func EchoWithIP(ectx echo.Context) context.Context

func FastOnAbort

func FastOnAbort(fctx *fasthttp.RequestCtx, err error)

func FastWithIPBackground

func FastWithIPBackground(fctx *fasthttp.RequestCtx) context.Context

func GRPCStreamAbort

func GRPCStreamAbort(err error) error

func GRPCStreamWithEmpty

func GRPCStreamWithEmpty(ctx context.Context, msg interface{}) context.Context

func GinOnAbort

func GinOnAbort(gctx *gin.Context, err error)

func GinWithIP

func GinWithIP(gctx *gin.Context) context.Context

func IrisOnAbort

func IrisOnAbort(ictx iris.Context, err error)

func IrisWithIP

func IrisWithIP(ictx iris.Context) context.Context

func KitOnAbort

func KitOnAbort(err error) (interface{}, error)

func KitWithEmpty

func KitWithEmpty(ctx context.Context, req interface{}) context.Context

func MicroClientWithEmpty

func MicroClientWithEmpty(ctx context.Context, req client.Request) context.Context

func MicroOnAbort

func MicroOnAbort(err error) error

func MicroServerEmpty

func MicroServerEmpty(ctx context.Context, req server.Request) context.Context

func MuxOnAbort

func MuxOnAbort(w http.ResponseWriter, err error)

func MuxWithIP

func MuxWithIP(req *http.Request) context.Context

func NetConnAbort

func NetConnAbort(err error) error

func NetConnWithBackground

func NetConnWithBackground() context.Context

func NewMicroClient

func NewMicroClient(thr gohalt.Throttler, with MicroClientWith, on MicroOn) client.Wrapper

func NewMicroHandler

func NewMicroHandler(thr gohalt.Throttler, with MicroServerWith, on MicroOn) server.HandlerWrapper

func NewMiddlewareBeego

func NewMiddlewareBeego(thr gohalt.Throttler, with BeegoWith, on BeegoOn) beego.FilterFunc

func NewMiddlewareEcho

func NewMiddlewareEcho(thr gohalt.Throttler, with EchoWith, on EchoOn) echo.MiddlewareFunc

func NewMiddlewareGin

func NewMiddlewareGin(thr gohalt.Throttler, with GinWith, on GinOn) gin.HandlerFunc

func NewMiddlewareIris

func NewMiddlewareIris(thr gohalt.Throttler, with IrisWith, on IrisOn) iris.Handler

func NewMiddlewareKit

func NewMiddlewareKit(thr gohalt.Throttler, with KitWith, on KitOn) endpoint.Middleware

func NewMiddlewareMux

func NewMiddlewareMux(h http.Handler, thr gohalt.Throttler, with MuxWith, on MuxOn) http.Handler

func NewMiddlewareRevel

func NewMiddlewareRevel(thr gohalt.Throttler, with RevealWith, on RevealOn) revel.Filter

func NewMiddlewareRouter

func NewMiddlewareRouter(h http.Handler, thr gohalt.Throttler, with RouterWith, on RouterOn) http.Handler

func NewMiddlewareStd

func NewMiddlewareStd(h http.Handler, thr gohalt.Throttler, with StdWith, on StdOn) http.Handler

func NewNetConn

func NewNetConn(conn net.Conn, thr gohalt.Throttler, with NetConnWith, on NetConnOn, mode NetConnMode) net.Conn

func NewRPCClientCodec

func NewRPCClientCodec(cc rpc.ClientCodec, thr gohalt.Throttler, with RPCCodecWith, on RPCCodecOn) rpc.ClientCodec

func NewRPCServerCodec

func NewRPCServerCodec(sc rpc.ServerCodec, thr gohalt.Throttler, with RPCCodecWith, on RPCCodecOn) rpc.ServerCodec

func NewReader

func NewReader(r io.Reader, thr gohalt.Throttler, with RWWith, on RWOn) io.Reader

func NewWriter

func NewWriter(w io.Writer, thr gohalt.Throttler, with RWWith, on RWOn) io.Writer

func RPCCodecOnAbort

func RPCCodecOnAbort(err error) error

func RPCCodecWithBackground

func RPCCodecWithBackground(req *rpc.Request, resp *rpc.Response, msg interface{}) context.Context

func RWAbort

func RWAbort(err error) error

func RWWithBackground

func RWWithBackground() context.Context

func RevealOnAbort

func RevealOnAbort(rc *revel.Controller, err error) revel.Result

func RevealWithIP

func RevealWithIP(rc *revel.Controller) context.Context

func RoundTripperFastBackground

func RoundTripperFastBackground(req *fasthttp.Request) context.Context

func RoundTripperFastOnAbort

func RoundTripperFastOnAbort(err error) error

func RoundTripperStdOnAbort

func RoundTripperStdOnAbort(err error) error

func RoundTripperStdWithEmpty

func RoundTripperStdWithEmpty(req *http.Request) context.Context

func RouterOnAbort

func RouterOnAbort(w http.ResponseWriter, err error)

func RouterWithIP

func RouterWithIP(req *http.Request) context.Context

func SQLClientAbort

func SQLClientAbort(err error) error

func SQLClientQuery

func SQLClientQuery(ctx context.Context, query string, args ...interface{}) context.Context

func StdOnAbort

func StdOnAbort(w http.ResponseWriter, err error)

func StdWithIP

func StdWithIP(req *http.Request) context.Context

Types

type BeegoOn

type BeegoOn func(*beegoctx.Context, error)

type BeegoWith

type BeegoWith func(*beegoctx.Context) context.Context

type EchoOn

type EchoOn func(echo.Context, error) error

type EchoWith

type EchoWith func(echo.Context) context.Context

type FastOn

type FastOn func(*fasthttp.RequestCtx, error)

type FastWith

type FastWith func(*fasthttp.RequestCtx) context.Context

type GRPCStreamOn

type GRPCStreamOn func(error) error

type GRPCStreamWith

type GRPCStreamWith func(context.Context, interface{}) context.Context

type GinOn

type GinOn func(*gin.Context, error)

type GinWith

type GinWith func(*gin.Context) context.Context

type IrisOn

type IrisOn func(iris.Context, error)

type IrisWith

type IrisWith func(iris.Context) context.Context

type KitOn

type KitOn func(error) (interface{}, error)

type KitWith

type KitWith func(context.Context, interface{}) context.Context

type MicroClientWith

type MicroClientWith func(context.Context, client.Request) context.Context

type MicroOn

type MicroOn func(error) error

type MicroServerWith

type MicroServerWith func(context.Context, server.Request) context.Context

type MuxOn

type MuxOn StdOn

type MuxWith

type MuxWith StdWith

type NetConnMode

type NetConnMode int
const (
	NetConnModeRead  NetConnMode = iota
	NetConnModeWrite NetConnMode = iota
)

type NetConnOn

type NetConnOn func(error) error

type NetConnWith

type NetConnWith func() context.Context

type RPCCodecOn

type RPCCodecOn func(error) error

type RPCCodecWith

type RPCCodecWith func(*rpc.Request, *rpc.Response, interface{}) context.Context

type RWOn

type RWOn func(error) error

type RWWith

type RWWith func() context.Context

type RevealOn

type RevealOn func(error) revel.Result

type RevealWith

type RevealWith func(*revel.Controller) context.Context

type RoundTripperFast

type RoundTripperFast interface {
	Do(req *fasthttp.Request, resp *fasthttp.Response) error
}

type RoundTripperFastOn

type RoundTripperFastOn func(error) error

type RoundTripperFastWith

type RoundTripperFastWith func(*fasthttp.Request) context.Context

type RoundTripperStdOn

type RoundTripperStdOn func(error) error

type RoundTripperStdWith

type RoundTripperStdWith func(*http.Request) context.Context

type RouterOn

type RouterOn StdOn

type RouterWith

type RouterWith StdWith

type SQLClient

type SQLClient interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
}

func NewSQLClient

func NewSQLClient(cli SQLClient, thr gohalt.Throttler, with SQLClientWith, on SQLClientOn) SQLClient

type SQLClientOn

type SQLClientOn func(error) error

type SQLClientWith

type SQLClientWith func(context.Context, string, ...interface{}) context.Context

type StdOn

type StdOn func(http.ResponseWriter, error)

type StdWith

type StdWith func(*http.Request) context.Context

Jump to

Keyboard shortcuts

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