1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-22 22:59:43 +02:00

pointers to Runtime!

This commit is contained in:
Harvey Kandola 2017-07-24 19:10:49 +01:00
parent 792c3e2ce8
commit 27640dffc4
15 changed files with 315 additions and 82 deletions

View file

@ -62,7 +62,7 @@ func (s routeSorter) Less(i, j int) bool {
return s[i].ord < s[j].ord
}
func routesKey(rt env.Runtime, prefix, path string, methods, queries []string) (string, error) {
func routesKey(rt *env.Runtime, prefix, path string, methods, queries []string) (string, error) {
rd := routeDef{
Prefix: prefix,
Path: path,
@ -79,7 +79,7 @@ func routesKey(rt env.Runtime, prefix, path string, methods, queries []string) (
}
// Add an endpoint to those that will be processed when Serve() is called.
func Add(rt env.Runtime, prefix, path string, methods, queries []string, endPtFn RouteFunc) error {
func Add(rt *env.Runtime, prefix, path string, methods, queries []string, endPtFn RouteFunc) error {
k, e := routesKey(rt, prefix, path, methods, queries)
if e != nil {
return e
@ -89,7 +89,7 @@ func Add(rt env.Runtime, prefix, path string, methods, queries []string, endPtFn
}
// Remove an endpoint.
func Remove(rt env.Runtime, prefix, path string, methods, queries []string) error {
func Remove(rt *env.Runtime, prefix, path string, methods, queries []string) error {
k, e := routesKey(rt, prefix, path, methods, queries)
if e != nil {
return e
@ -99,7 +99,7 @@ func Remove(rt env.Runtime, prefix, path string, methods, queries []string) erro
}
// BuildRoutes returns all matching routes for specified scope.
func BuildRoutes(rt env.Runtime, prefix string) *mux.Router {
func BuildRoutes(rt *env.Runtime, prefix string) *mux.Router {
var rs routeSorter
for k, v := range routes {
var rd routeDef