httputils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateError

func CreateError(ctx context.Context, err error) (*common.ErrorResp, error)

func CreateFail

func CreateFail[T interface{}](ctx context.Context, err error, data T) (*common.FailureResp[T], error)

func CreateSuccess

func CreateSuccess[T interface{}](ctx context.Context, payload T) (*common.SuccessResp[T], error)

func ExtractRequestID

func ExtractRequestID(r *http.Request) string

func GetMetadata

func GetMetadata(ctx context.Context) (*common.Metadata, error)

func GetRequestDuration

func GetRequestDuration(ctx context.Context) (int, error)

func NewWriter

func NewWriter(l *zap.Logger, rw http.ResponseWriter) *writer

func WriteError

func WriteError(ctx context.Context, l *zap.Logger, rw http.ResponseWriter, inErr error)

func WriteFail

func WriteFail(ctx context.Context, l *zap.Logger, rw http.ResponseWriter, inErr error, data interface{})

func WriteSuccess

func WriteSuccess(ctx context.Context, l *zap.Logger, rw http.ResponseWriter, payload interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

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