package handlers import ( "giteapm/config" "gorm.io/gorm" ) type Handlers struct { DB *gorm.DB Cfg *config.Config } func NewHandlers(db *gorm.DB, cfg *config.Config) *Handlers { return &Handlers{ DB: db, Cfg: cfg, } } type Response struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` } type PaginatedResponse struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` Total int64 `json:"total"` Page int `json:"page"` Limit int `json:"limit"` } func SuccessResponse(data interface{}) Response { return Response{ Code: 200, Message: "success", Data: data, } } func ErrorResponse(code int, message string) Response { return Response{ Code: code, Message: message, } } func PaginatedSuccessResponse(data interface{}, total int64, page, limit int) PaginatedResponse { return PaginatedResponse{ Code: 200, Message: "success", Data: data, Total: total, Page: page, Limit: limit, } }