api

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Index

Constants

View Source
const (
	METHOD_UNSPECIFIED = 0 + iota // (DEFAULT)
	GET
	HEAD
	POST
	PUT
	DELETE
	CONNECT
	OPTIONS
	TRACE
)

Variables

View Source
var (
	CacheApi = sync.Map{}
	EmptyApi = &API{}
)
View Source
var RequestMethodValue = map[string]int32{
	"METHOD_UNSPECIFIED": 0,
	"GET":                1,
	"HEAD":               2,
	"POST":               3,
	"PUT":                4,
	"DELETE":             5,
	"CONNECT":            6,
	"OPTIONS":            7,
	"TRACE":              8,
}

Functions

This section is empty.

Types

type API

type API struct {
	Name          string      `json:"name" yaml:"name"`
	ITypeStr      string      `json:"itype" yaml:"itype"`
	IType         ApiType     `json:"-" yaml:"-"`
	OTypeStr      string      `json:"otype" yaml:"otype"`
	OType         ApiType     `json:"-" yaml:"-"`
	Status        Status      `json:"status" yaml:"status"`
	Metadata      interface{} `json:"metadata" yaml:"metadata"`
	Method        string      `json:"method" yaml:"method"`
	RequestMethod `json:",omitempty" yaml:"-"`
}

API is api gateway concept, control request from browser、Mobile APP、third party people

func NewApi

func NewApi() *API

NewApi

func (*API) FindApi

func (a *API) FindApi(name string) (*API, bool)

FindApi find a api, if not exist, return false

func (*API) IsOk

func (a *API) IsOk(name string) bool

IsOk api status equals Up

func (*API) MatchMethod

func (a *API) MatchMethod(method string) bool

MatchMethod

func (*API) Offline

func (a *API) Offline(name string)

Offline api offline

func (*API) Online

func (a *API) Online(name string)

Online api online

type ApiType

type ApiType int32

type RequestMethod

type RequestMethod int32

type Status

type Status int32

Status is the components status

const (
	Down    Status = 0
	Up      Status = 1
	Unknown Status = 2
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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