1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

formatting

Former-commit-id: 037081db5d6d4434e873ca8b75334ee43e046b6a
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-08-17 10:06:20 +03:00
parent 00967408dc
commit 07046ab978
112 changed files with 477 additions and 517 deletions

View File

@@ -41,10 +41,10 @@ func main() {
})
app.Get("/set", func(ctx iris.Context) {
s := sess.Start(ctx)
//set session values
// set session values
s.Set("name", "iris")
//test if set here
// test if set here
ctx.Writef("All ok session value of the 'name' is: %s", s.GetString("name"))
})
@@ -83,7 +83,7 @@ func main() {
})
app.Get("/destroy", func(ctx iris.Context) {
//destroy, removes the entire session data and cookie
// destroy, removes the entire session data and cookie
sess.Destroy(ctx)
})

View File

@@ -42,10 +42,10 @@ func main() {
})
app.Get("/set", func(ctx iris.Context) {
s := sess.Start(ctx)
//set session values
// set session values
s.Set("name", "iris")
//test if set here
// test if set here
ctx.Writef("All ok session value of the 'name' is: %s", s.GetString("name"))
})
@@ -84,7 +84,7 @@ func main() {
})
app.Get("/destroy", func(ctx iris.Context) {
//destroy, removes the entire session data and cookie
// destroy, removes the entire session data and cookie
sess.Destroy(ctx)
})

View File

@@ -60,10 +60,10 @@ func main() {
})
app.Get("/set", func(ctx iris.Context) {
s := sess.Start(ctx)
//set session values
// set session values
s.Set("name", "iris")
//test if set here
// test if set here
ctx.Writef("All ok session value of the 'name' is: %s", s.GetString("name"))
})
@@ -120,7 +120,7 @@ func main() {
})
app.Get("/destroy", func(ctx iris.Context) {
//destroy, removes the entire session data and cookie
// destroy, removes the entire session data and cookie
sess.Destroy(ctx)
})

View File

@@ -46,12 +46,12 @@ func main() {
ctx.HTML("</ul>")
})
//set session values.
// set session values.
app.Get("/set", func(ctx iris.Context) {
session := sessions.Get(ctx)
session.Set("name", "iris")
//test if set here.
// test if set here.
ctx.Writef("All ok session set to: %s", session.GetString("name"))
// Set will set the value as-it-is,
@@ -97,7 +97,7 @@ func main() {
})
app.Get("/destroy", func(ctx iris.Context) {
//destroy, removes the entire session data and cookie
// destroy, removes the entire session data and cookie
// sess.Destroy(ctx)
// or
sessions.Get(ctx).Destroy()
@@ -123,7 +123,6 @@ func main() {
// try to change it, if we used `Set` instead of `SetImmutable` this
// change will affect the underline array of the session's value "businessEdit", but now it will not.
businessGet[0].Name = "Gabriel"
})
app.Get("/get_immutable", func(ctx iris.Context) {

View File

@@ -12,7 +12,6 @@ var (
)
func secret(ctx iris.Context) {
// Check if user is authenticated
if auth, _ := sess.Start(ctx).GetBoolean("authenticated"); !auth {
ctx.StatusCode(iris.StatusForbidden)

View File

@@ -34,12 +34,11 @@ func newApp() *iris.Application {
ctx.Writef("You should navigate to the /set, /get, /delete, /clear,/destroy instead")
})
app.Get("/set", func(ctx iris.Context) {
//set session values
// set session values
s := mySessions.Start(ctx)
s.Set("name", "iris")
//test if set here
// test if set here
ctx.Writef("All ok session set to: %s", s.GetString("name"))
})
@@ -68,7 +67,7 @@ func newApp() *iris.Application {
})
app.Get("/destroy", func(ctx iris.Context) {
//destroy, removes the entire session data and cookie
// destroy, removes the entire session data and cookie
mySessions.Destroy(ctx)
})
// Note about destroy: