rest

package module
v0.1.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2017 License: MIT Imports: 10 Imported by: 0

README

A rest framework based on gin

Usage

See example/main.go

Run example

glide install --strip-vendor

go build -o bin/kv-server example/main.go

bin/kv-server --help

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIGroup

type APIGroup struct {
	Name      string
	Resources []Resource
}

type Config

type Config struct {
	BindAddr              string
	EnableDebug           bool
	EnableMetrics         bool
	EnableDiscovery       bool
	GraceShutdownTimeoutS int
}

type Handler

type Handler struct {
	Resource
	HandlerFunc gin.HandlerFunc
}

type Resource

type Resource struct {
	Name   string
	Path   string
	Method string
}

type Server

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

func NewServer

func NewServer(config Config) *Server

func (*Server) RegisterService

func (s *Server) RegisterService(svc Service)

func (*Server) RegisterServiceGroup

func (s *Server) RegisterServiceGroup(svc ServiceGroup)

func (*Server) Run

func (s *Server) Run() error

func (*Server) Shutdown

func (s *Server) Shutdown()

type Service

type Service interface {
	ListHandlers() []Handler
}

type ServiceGroup

type ServiceGroup interface {
	Service
	GetAPIGroup() string
}

type Version

type Version struct {
	Version   string
	BuildDate string
	GoVersion string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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