Help us shape the future of Go! Take the 2026 Go Developer Survey

rest

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIs = map[string]*API{}

APIs the loaded RESTful APIs

View Source
var Guards = map[string]gin.HandlerFunc{}

Guards The Guard list

Functions

func Bind

func Bind(srv *http.Server, option Option, middlewares ...gin.HandlerFunc) error

Bind the http server

Types

type API

type API struct {
	Name   string
	Source string
	REST   REST
	// contains filtered or unexported fields
}

API The RESTFul API

type In

type In struct {
	// contains filtered or unexported fields
}

In the in struct

type Option

type Option struct {
	Mode string `json:"mode,omitempty"` // the server mode production / development
	Root string `json:"root,omitempty"` // the root route path of the RESTFul API server
}

Option the server option

type Out

type Out struct {
	Status  int               `json:"status"`
	Type    string            `json:"type,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

Out The RESTFul API output

type Path

type Path struct {
	Label       string        `json:"label,omitempty"`
	Description string        `json:"description,omitempty"`
	Path        string        `json:"path"`
	Method      string        `json:"method"`
	Process     string        `json:"process"`
	Guard       string        `json:"guard,omitempty"`
	In          []interface{} `json:"in,omitempty"`
	Out         Out           `json:"out,omitempty"`
}

Path The RESTFul API Route path

type REST

type REST struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Group       string `json:"-"`
	Description string `json:"description,omitempty"`
	Guard       string `json:"guard,omitempty"`
	Paths       []Path `json:"paths,omitempty"`
}

REST The RESTFul API

Jump to

Keyboard shortcuts

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