Removed DefaultTable() from global vars
We will not initialize DefaultTable as global var unless the users asks for it explicitly.
This commit is contained in:
parent
d7f0db04ec
commit
ad92e6821e
@ -1,11 +1,6 @@
|
|||||||
// Package router provides an interface for micro network routers
|
// Package router provides an interface for micro network routers
|
||||||
package router
|
package router
|
||||||
|
|
||||||
var (
|
|
||||||
// DefaultRouter returns default micro router
|
|
||||||
DefaultRouter = NewRouter()
|
|
||||||
)
|
|
||||||
|
|
||||||
// Router is micro network router
|
// Router is micro network router
|
||||||
type Router interface {
|
type Router interface {
|
||||||
// Initi initializes Router with options
|
// Initi initializes Router with options
|
||||||
@ -49,7 +44,8 @@ type QueryOption func(*QueryOptions)
|
|||||||
func NewRouter(opts ...Option) Router {
|
func NewRouter(opts ...Option) Router {
|
||||||
// set default options
|
// set default options
|
||||||
ropts := Options{
|
ropts := Options{
|
||||||
Table: DefaultTable,
|
// Default table
|
||||||
|
Table: NewTable(),
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
|
@ -6,8 +6,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// DefaultRouter returns default micro router
|
|
||||||
DefaultTable = NewTable()
|
|
||||||
// ErrRouteNotFound is returned when no route was found
|
// ErrRouteNotFound is returned when no route was found
|
||||||
ErrRouteNotFound = errors.New("route not found")
|
ErrRouteNotFound = errors.New("route not found")
|
||||||
// ErrDuplicateRoute is return when route already exists
|
// ErrDuplicateRoute is return when route already exists
|
||||||
|
Loading…
x
Reference in New Issue
Block a user