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:
@ -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 {
|
||||
|
Reference in New Issue
Block a user