api

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 5 Imported by: 0

README

go-api

Documentation

Index

Constants

View Source
const MimeJson = "application/json"

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	JOk        bool   `json:"ok"`
	JMsg       string `json:"msg"`
	JData      any    `json:"data"`
	Code       int    `json:"-"`
	IsBeautify bool   `json:"-"`
	// contains filtered or unexported fields
}

func New

func New(r *http.Request) *Api

func (*Api) AddMsg

func (a *Api) AddMsg(msg string)

func (*Api) Err

func (a *Api) Err(err error) bool

func (*Api) JsonMarshal

func (a *Api) JsonMarshal(v any) ([]byte, error)

func (*Api) Msg

func (a *Api) Msg(msg string)

func (*Api) Ok

func (a *Api) Ok(data any)

func (*Api) ParseJson

func (a *Api) ParseJson(v any) error

func (*Api) Request

func (a *Api) Request() *http.Request

func (*Api) Response

func (a *Api) Response(w http.ResponseWriter)

Jump to

Keyboard shortcuts

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