Landed the topic list page (no topics yet, so appearances are deceiving)
This commit is contained in:
@@ -50,6 +50,7 @@ type AmContext interface {
|
||||
RC() int
|
||||
OutputType() string
|
||||
Parameter(string) string
|
||||
QueryParamInt(string, int) int
|
||||
RemoteIP() string
|
||||
ReplaceUser(*database.User)
|
||||
SaveSession() error
|
||||
@@ -241,6 +242,19 @@ func (c *amContext) Parameter(name string) string {
|
||||
return rc
|
||||
}
|
||||
|
||||
// QueryParamInt returns the value of a query parameter as an integer, with a default.
|
||||
func (c *amContext) QueryParamInt(name string, defval int) int {
|
||||
s := c.echoContext.QueryParam(name)
|
||||
if s == "" {
|
||||
return defval
|
||||
}
|
||||
rc, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
return defval
|
||||
}
|
||||
return rc
|
||||
}
|
||||
|
||||
// RemoteIP returns the remote IP address.
|
||||
func (c *amContext) RemoteIP() string {
|
||||
return c.echoContext.RealIP()
|
||||
|
||||
Reference in New Issue
Block a user