api

package
v0.0.0-...-21518f5 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvildInput       = fmt.Errorf("Error Input Format")
	ErrIllegalDataFormat = fmt.Errorf("illegal_data_format")
	InterError           = fmt.Errorf("Interal Error")
)
View Source
var (
	ErrInvaildID  = errors.New("Invaild ID")
	ErrBodyFormat = errors.New("Invaild Body Content Format")
)

Functions

func Create

func Create(curd CURD) gin.HandlerFunc

func Delete

func Delete(curd CURD) gin.HandlerFunc

func NewError

func NewError(err error, des interface{}) *apiError

func PageQuery

func PageQuery(c *gin.Context, v interface{}) error

Page Query will check

func RsaDecrypt

func RsaDecrypt(ciphertext []byte, privateKey []byte) ([]byte, error)

func RsaEncrypt

func RsaEncrypt(origData []byte, publicKey []byte) ([]byte, error)

Types

type CURD

type CURD interface {
	GetBy(key string, value ...interface{}) error
	Create() error
	Check() error
	Delete() error
	Data() interface{}
}

type Error

type Error interface {
	Error() error
	Description() interface{}
}

type Rsp

type Rsp struct {
	Data interface{} `json:"-"`

	ErrorCode        int         `json:"-"`
	ErrorMsg         string      `json:"message"`
	ErrorDescription interface{} `json:"description"`
	// contains filtered or unexported fields
}

func NewRsp

func NewRsp(c *gin.Context) *Rsp

func (*Rsp) Error

func (rsp *Rsp) Error(code int, err Error)

func (*Rsp) Render

func (r *Rsp) Render()

func (*Rsp) SetError

func (rsp *Rsp) SetError(code int, err error)

func (*Rsp) WriteRaw

func (rsp *Rsp) WriteRaw(data interface{})

Jump to

Keyboard shortcuts

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