response_logger

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteError

func WriteError(c *gin.Context, log *logger.EntityLogger, re *ErrorResponse)

WriteError gửi response lỗi + ghi log error

func WriteErrorSimple

func WriteErrorSimple(c *gin.Context, log *logger.EntityLogger, status int, err error)

WriteErrorSimple dùng nếu không cần log chi tiết

func WriteSuccess

func WriteSuccess(c *gin.Context, data interface{})

WriteSuccess gửi response thành công (có thể log nếu muốn)

func WriteSuccessWithLog

func WriteSuccessWithLog(c *gin.Context, log *logger.EntityLogger, data interface{})

WriteSuccessWithLog gửi response thành công + log (tuỳ chọn)

Types

type ErrorResponse

type ErrorResponse struct {
	Status    int
	Error     error
	TimeStamp time.Time
}

func NewErrorResponse

func NewErrorResponse(status int, Error error, timeStamp time.Time) *ErrorResponse

func (*ErrorResponse) PrintErrorResponse

func (e *ErrorResponse) PrintErrorResponse()

type ResponseHandle

type ResponseHandle struct {
	Status    int         `json:"status"`
	Data      interface{} `json:"data,omitempty"`
	Message   string      `json:"message,omitempty"`
	Timestamp time.Time   `json:"timestamp"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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