wrapper

package
v0.0.0-...-87fb0b3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RouterWrapper

type RouterWrapper interface {
	Add(child RouterWrapper) error
	FullPath() string

	Router() *mux.Router
	SetRouter(*mux.Router)

	Children() []RouterWrapper

	Parent() RouterWrapper
	SetParent(RouterWrapper)

	Handler() http.HandlerFunc
	SubPath() string
	Methods() []string
}

RouterWrapper is an interface for wrapper

type Wrapper

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

Wrapper wraps router with tree structure

func New

func New(path string, methods []string, handler http.HandlerFunc) *Wrapper

New is a constructor for the wrapper

func (*Wrapper) Add

func (w *Wrapper) Add(child RouterWrapper) error

Add adds child as a child (child node of a tree) of w

func (*Wrapper) Children

func (w *Wrapper) Children() []RouterWrapper

Children returns its children

func (*Wrapper) FullPath

func (w *Wrapper) FullPath() string

FullPath builds full path string of the api

func (*Wrapper) Handler

func (w *Wrapper) Handler() http.HandlerFunc

Handler returns its handler

func (*Wrapper) Methods

func (w *Wrapper) Methods() []string

Methods returns its methods

func (*Wrapper) Parent

func (w *Wrapper) Parent() RouterWrapper

Parent returns its parent

func (*Wrapper) Router

func (w *Wrapper) Router() *mux.Router

Router returns its router

func (*Wrapper) SetParent

func (w *Wrapper) SetParent(parent RouterWrapper)

SetParent sets parent

func (*Wrapper) SetRouter

func (w *Wrapper) SetRouter(r *mux.Router)

SetRouter sets its router

func (*Wrapper) SubPath

func (w *Wrapper) SubPath() string

SubPath returns its subPath

Jump to

Keyboard shortcuts

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