contracts

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorDetail

type ErrorDetail struct {
	Code   string            `json:"code"`
	Errors map[string]string `json:"errors"`
}

type ResponseFail

type ResponseFail struct {
	HttpCode int         `json:"http_code"`
	Message  string      `json:"message"`
	Details  ErrorDetail `json:"details"`
}

func NewResponseBadRequest

func NewResponseBadRequest(message string) (int, ResponseFail)

func NewResponseBadRequestWithDetail

func NewResponseBadRequestWithDetail(message, errorCode string, errors map[string]string) (int, ResponseFail)

func NewResponseFail

func NewResponseFail(httpCode int, message string, details ErrorDetail) (int, ResponseFail)

func NewResponseInternalServerError

func NewResponseInternalServerError(message string) (int, ResponseFail)

type ResponseSuccess

type ResponseSuccess[T any] struct {
	HttpCode int    `json:"http_code"`
	Message  string `json:"message"`
	Content  T      `json:"content"`
}

func NewResponseOK

func NewResponseOK[T any](message string, content T) (int, ResponseSuccess[T])

func NewResponseSuccess

func NewResponseSuccess[T any](httpCode int, message string, content T) (int, ResponseSuccess[T])

Jump to

Keyboard shortcuts

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