You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
524 B

package common
import "github.com/imdotdev/im.dev/server/pkg/e"
type Resp struct {
Status string `json:"status"`
Data interface{} `json:"data,omitempty"`
Message string `json:"message,omitempty"`
}
func RespSuccess(data interface{}) *Resp {
r := &Resp{}
r.Status = Success
r.Data = data
return r
}
func RespError(msg string) *Resp {
r := &Resp{}
r.Status = Error
r.Message = msg
return r
}
func RespInternalError() *Resp {
r := &Resp{}
r.Status = Error
r.Message = e.Internal
return r
}