mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
077984bd60
**Sessions were re-written ** - Developers can use more than one 'session database', at the same time, to store the sessions - Easy to develop a custom session database (only two functions are required (Load & Update)), [learn more](https://github.com/iris-contrib/sessiondb/blob/master/redis/database.go) - Session databases are located [here](https://github.com/iris-contrib/sessiondb), contributions are welcome - The only frontend deleted 'thing' is the: **config.Sessions.Provider** - No need to register a database, the sessions works out-of-the-box - No frontend/API changes except the `context.Session().Set/Delete/Clear`, they doesn't return errors anymore, btw they (errors) were always nil :) - Examples (master branch) were updated. ```sh $ go get github.com/iris-contrib/sessiondb/$DATABASE ``` ```go db := $DATABASE.New(configurationHere{}) iris.UseSessionDB(db) ``` > Note: Book is not updated yet, examples are up-to-date as always.
97 lines
2.5 KiB
Go
97 lines
2.5 KiB
Go
package context
|
|
|
|
import (
|
|
"bufio"
|
|
"io"
|
|
"time"
|
|
|
|
"github.com/valyala/fasthttp"
|
|
)
|
|
|
|
type (
|
|
|
|
// IContext the interface for the iris/context
|
|
// Used mostly inside packages which shouldn't be import ,directly, the kataras/iris.
|
|
IContext interface {
|
|
Param(string) string
|
|
ParamInt(string) (int, error)
|
|
ParamInt64(string) (int64, error)
|
|
URLParam(string) string
|
|
URLParamInt(string) (int, error)
|
|
URLParamInt64(string) (int64, error)
|
|
URLParams() map[string]string
|
|
MethodString() string
|
|
HostString() string
|
|
Subdomain() string
|
|
PathString() string
|
|
RequestPath(bool) string
|
|
RequestIP() string
|
|
RemoteAddr() string
|
|
RequestHeader(k string) string
|
|
FormValueString(string) string
|
|
FormValues(string) []string
|
|
SetStatusCode(int)
|
|
SetContentType(string)
|
|
SetHeader(string, string)
|
|
Redirect(string, ...int)
|
|
RedirectTo(string, ...interface{})
|
|
NotFound()
|
|
Panic()
|
|
EmitError(int)
|
|
Write(string, ...interface{})
|
|
HTML(int, string)
|
|
Data(int, []byte) error
|
|
RenderWithStatus(int, string, interface{}, ...map[string]interface{}) error
|
|
Render(string, interface{}, ...map[string]interface{}) error
|
|
MustRender(string, interface{}, ...map[string]interface{})
|
|
TemplateString(string, interface{}, ...map[string]interface{}) string
|
|
MarkdownString(string) string
|
|
Markdown(int, string)
|
|
JSON(int, interface{}) error
|
|
JSONP(int, string, interface{}) error
|
|
Text(int, string) error
|
|
XML(int, interface{}) error
|
|
ServeContent(io.ReadSeeker, string, time.Time, bool) error
|
|
ServeFile(string, bool) error
|
|
SendFile(string, string) error
|
|
Stream(func(*bufio.Writer))
|
|
StreamWriter(cb func(*bufio.Writer))
|
|
StreamReader(io.Reader, int)
|
|
ReadJSON(interface{}) error
|
|
ReadXML(interface{}) error
|
|
ReadForm(interface{}) error
|
|
Get(string) interface{}
|
|
GetString(string) string
|
|
GetInt(string) int
|
|
Set(string, interface{})
|
|
VisitAllCookies(func(string, string))
|
|
SetCookie(*fasthttp.Cookie)
|
|
SetCookieKV(string, string)
|
|
RemoveCookie(string)
|
|
GetFlashes() map[string]string
|
|
GetFlash(string) (string, error)
|
|
SetFlash(string, string)
|
|
Session() interface {
|
|
ID() string
|
|
Get(string) interface{}
|
|
GetString(key string) string
|
|
GetInt(key string) int
|
|
GetAll() map[string]interface{}
|
|
VisitAll(cb func(k string, v interface{}))
|
|
Set(string, interface{})
|
|
Delete(string)
|
|
Clear()
|
|
}
|
|
SessionDestroy()
|
|
Log(string, ...interface{})
|
|
Reset(*fasthttp.RequestCtx)
|
|
GetRequestCtx() *fasthttp.RequestCtx
|
|
Clone() IContext
|
|
Do()
|
|
Next()
|
|
StopExecution()
|
|
IsStopped() bool
|
|
GetHandlerName() string
|
|
}
|
|
)
|