rest

package module
v0.1.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2018 License: MIT Imports: 12 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

View Source
const DefaultGroup = "/"

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(group string, svc Service)

func (*Server) Run

func (s *Server) Run() error

func (*Server) Shutdown

func (s *Server) Shutdown()

type Service

type Service interface {
	ListHandlers() []Handler
}

type Version

type Version struct {
	Version   string
	BuildDate string
	GoVersion string
}

Directories

Path Synopsis
example
kv

Jump to

Keyboard shortcuts

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