commons

package
v0.0.0-...-e8a8f99 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DBOperationAbnormal occurred db expection.
	DBOperationAbnormal = http.StatusInternalServerError
)

Adds definition status code

Variables

View Source
var (
	// OK -> 0
	OK = &Error{Code: 0, Error: nil}
	// StatusDBOperationAbnormal -> DBOperationAbnormal
	StatusDBOperationAbnormal = &Error{Code: DBOperationAbnormal, Error: errors.New("database operation abnormal")}
)

Functions

This section is empty.

Types

type Error

type Error struct {
	Code  int
	Error error
}

Error customer.

func (*Error) Format

func (r *Error) Format() string

Format returns string of curr.

type WebAPIResponse

type WebAPIResponse struct {
	Code    int
	Message string
	Data    interface{}
}

WebAPIResponse wrapper of anything from bi.

func ErrorWithCustomer

func ErrorWithCustomer(r Error) WebAPIResponse

ErrorWithCustomer returns customer results.

func ErrorWithMessage

func ErrorWithMessage(m string) WebAPIResponse

ErrorWithMessage returns customer results.

func Success

func Success(data interface{}) WebAPIResponse

Success returns perfact rerults.

Jump to

Keyboard shortcuts

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