Documentation ¶
Index ¶
Constants ¶
View Source
const (
CookieAuthName = "access_token"
)
View Source
const (
ErrInternalServer = "Ошибка на сервере"
)
Variables ¶
View Source
var ErrCookieNotPresented = myerrors.NewErrorBadFormatRequest("Должна быть выставлена cookie, а её нет")
Functions ¶
func HandleErr ¶
func HandleErr(w http.ResponseWriter, logger *my_logger.MyLogger, err error)
HandleErr this function handle err. If err is myerror. Error then we built this error and client get it, otherwise it is internal error and client shouldn`t get it.
func SendResponse ¶
func SendResponse(w http.ResponseWriter, logger *my_logger.MyLogger, response any)
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { Status int `json:"status"` Body ResponseBodyError `json:"body"` }
func NewErrResponse ¶
func NewErrResponse(status int, err string) *ErrorResponse
type ResponseBody ¶
type ResponseBody struct {
Message string `json:"message"`
}
type ResponseBodyError ¶
type ResponseBodyError struct {
Error string `json:"error"`
}
type ResponseBodyID ¶
type ResponseBodyID struct {
ID uint64 `json:"id"`
}
type ResponseID ¶
type ResponseID struct { Status int `json:"status"` Body ResponseBodyID `json:"body"` }
func NewResponseIDRedirect ¶
func NewResponseIDRedirect(ID uint64) *ResponseID
type ResponseSuccessful ¶
type ResponseSuccessful struct { Status int `json:"status"` Body ResponseBody `json:"body"` }
func NewResponseSuccessful ¶
func NewResponseSuccessful(message string) *ResponseSuccessful
Click to show internal directories.
Click to hide internal directories.