srvUtils

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HttpCtxPool = sync.Pool{
	New: func() interface{} {
		return &HttpCtx{
			request:      &HttpRequest{},
			response:     &HttpResponse{},
			values:       make(map[string]interface{}, 10),
			routerValues: nil,
		}
	},
}
View Source
var KafkaCtxPool = sync.Pool{
	New: func() interface{} {
		return &KafkaCtx{
			request:  &kafkaRequest{},
			response: &HttpResponse{},
			values:   make(map[string]interface{}, 10),
		}
	},
}

Functions

This section is empty.

Types

type HttpCookie

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

func (*HttpCookie) FromHttp

func (t *HttpCookie) FromHttp(cookie []*http.Cookie)

func (*HttpCookie) Get

func (t *HttpCookie) Get(key string) string

func (*HttpCookie) GetAsMap

func (t *HttpCookie) GetAsMap() map[string]string

func (*HttpCookie) Set

func (t *HttpCookie) Set(key string, value string, path string, expires time.Duration)

func (*HttpCookie) ToHttp

func (t *HttpCookie) ToHttp(domain string, sameSite string, httpOnly bool, secure bool) []string

type HttpCtx

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

func (*HttpCtx) Fill

func (t *HttpCtx) Fill(request *http.Request)

func (*HttpCtx) GetRequest

func (t *HttpCtx) GetRequest() interfaces.IRequest

func (*HttpCtx) GetResponse

func (t *HttpCtx) GetResponse() interfaces.IResponse

func (*HttpCtx) GetRouterValue added in v0.1.0

func (t *HttpCtx) GetRouterValue(key string) string

func (*HttpCtx) GetUserValue

func (t *HttpCtx) GetUserValue(key string) (interface{}, error)

func (*HttpCtx) PushUserValue

func (t *HttpCtx) PushUserValue(key string, val interface{})

func (*HttpCtx) SetRouteProps added in v0.1.0

func (t *HttpCtx) SetRouteProps(values map[string]string)

type HttpHeader

type HttpHeader struct {
	http.Header
}

func (*HttpHeader) GetAsMap

func (t *HttpHeader) GetAsMap() map[string][]string

type HttpRequest

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

func (*HttpRequest) Fill

func (t *HttpRequest) Fill(request *http.Request)

func (*HttpRequest) GetBody

func (t *HttpRequest) GetBody() io.ReadCloser

func (*HttpRequest) GetBodySize

func (t *HttpRequest) GetBodySize() int64

func (*HttpRequest) GetCookie

func (t *HttpRequest) GetCookie() interfaces.ICookie

func (*HttpRequest) GetHeader

func (t *HttpRequest) GetHeader() interfaces.IHeader

func (*HttpRequest) GetMethod

func (t *HttpRequest) GetMethod() string

func (*HttpRequest) GetQuery

func (t *HttpRequest) GetQuery() interfaces.IQuery

func (*HttpRequest) GetRemoteHost

func (t *HttpRequest) GetRemoteHost() string

func (*HttpRequest) GetRemoteIP

func (t *HttpRequest) GetRemoteIP() string

func (*HttpRequest) GetURI

func (t *HttpRequest) GetURI() string

func (*HttpRequest) GetUserAgent

func (t *HttpRequest) GetUserAgent() string

type HttpResponse

type HttpResponse struct {
	Body       []byte
	StatusCode int
	// contains filtered or unexported fields
}

func (*HttpResponse) Clear

func (t *HttpResponse) Clear()

func (*HttpResponse) Cookie

func (t *HttpResponse) Cookie() interfaces.ICookie

func (*HttpResponse) GetBody

func (t *HttpResponse) GetBody() []byte

func (*HttpResponse) GetStatus

func (t *HttpResponse) GetStatus() int

func (*HttpResponse) Header

func (t *HttpResponse) Header() interfaces.IHeader

func (*HttpResponse) SetBody

func (t *HttpResponse) SetBody(data []byte)

func (*HttpResponse) SetStatus

func (t *HttpResponse) SetStatus(status int)

type KafkaCtx

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

func (*KafkaCtx) Fill

func (t *KafkaCtx) Fill(msg *kafka.Message)

func (*KafkaCtx) GetRequest

func (t *KafkaCtx) GetRequest() interfaces.IRequest

func (*KafkaCtx) GetResponse

func (t *KafkaCtx) GetResponse() interfaces.IResponse

func (*KafkaCtx) GetRouterValue added in v0.1.0

func (t *KafkaCtx) GetRouterValue(key string) string

func (*KafkaCtx) GetUserValue

func (t *KafkaCtx) GetUserValue(key string) (interface{}, error)

func (*KafkaCtx) PushUserValue

func (t *KafkaCtx) PushUserValue(key string, val interface{})

func (*KafkaCtx) SetRouteProps added in v0.1.0

func (t *KafkaCtx) SetRouteProps(values map[string]string)

Jump to

Keyboard shortcuts

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