1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-02 20:28:38 -04:00

Move to a consistent way of handling IDs in URLs

This commit is contained in:
2017-11-12 21:12:49 -05:00
parent e99abfe866
commit 9624f0c5bc
9 changed files with 66 additions and 94 deletions

View File

@ -5,6 +5,7 @@ import (
"log"
"net/http"
"path"
"strconv"
"strings"
)
@ -35,6 +36,14 @@ func (c *Context) NextLevel() string {
return split[0]
}
func (c *Context) NextID() (int64, error) {
return strconv.ParseInt(c.NextLevel(), 0, 64)
}
func (c *Context) LastLevel() bool {
return len(c.remainingURL) == 0
}
type Handler func(*http.Request, *Context) ResponseWriterWriter
type APIHandler struct {