mirror of
https://github.com/alexedwards/scs.git
synced 2025-07-13 01:00:17 +02:00
Fix typos in documentation
This commit is contained in:
@ -103,6 +103,10 @@ However, there may be occasions when your use of a session store instance is tra
|
|||||||
```go
|
```go
|
||||||
func TestExample(t *testing.T) {
|
func TestExample(t *testing.T) {
|
||||||
sqldb, err := sql.Open("pg", "postgres://username:password@host/dbname")
|
sqldb, err := sql.Open("pg", "postgres://username:password@host/dbname")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
db := bun.NewDB(sqldb, pgdialect.New())
|
db := bun.NewDB(sqldb, pgdialect.New())
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ However, there may be occasions when your use of a session store instance is tra
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
func TestExample(t *testing.T) {
|
func TestExample(t *testing.T) {
|
||||||
db, err := sql.Open("postgres", "postgres://user:pass@localhost/db")
|
db, err := sql.Open("postgres", "postgres://username:password@host/dbname")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,7 @@ func main() {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
client, err := mongo.Connect(ctx, options.Client().ApplyURI("mongodb://localhost:27017"))
|
client, err := mongo.Connect(ctx, options.Client().ApplyURI("mongodb://host:27017"))
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err = client.Disconnect(ctx); err != nil {
|
if err = client.Disconnect(ctx); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -81,8 +80,8 @@ However, there may be occasions when your use of a session store instance is tra
|
|||||||
func TestExample(t *testing.T) {
|
func TestExample(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
client, err := mongo.Connect(ctx, options.Client().ApplyURI("mongodb://localhost:27017"))
|
|
||||||
|
|
||||||
|
client, err := mongo.Connect(ctx, options.Client().ApplyURI("mongodb://host:27017"))
|
||||||
defer func() {
|
defer func() {
|
||||||
if err = client.Disconnect(ctx); err != nil {
|
if err = client.Disconnect(ctx); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -86,7 +86,7 @@ However, there may be occasions when your use of a session store instance is tra
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
func TestExample(t *testing.T) {
|
func TestExample(t *testing.T) {
|
||||||
db, err := sql.Open("mysql", "user:pass@/db?parseTime=true")
|
db, err := sql.Open("mysql", "username:password@tcp(host)/dbname?parseTime=true")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ However, there may be occasions when your use of a session store instance is tra
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
func TestExample(t *testing.T) {
|
func TestExample(t *testing.T) {
|
||||||
pool, err := pgxpool.Connect(context.Background(), "postgres://user:pass@localhost/db")
|
pool, err := pgxpool.Connect(context.Background(), "postgres://username:password@host/dbname")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ However, there may be occasions when your use of a session store instance is tra
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
func TestExample(t *testing.T) {
|
func TestExample(t *testing.T) {
|
||||||
db, err := sql.Open("postgres", "postgres://user:pass@localhost/db")
|
db, err := sql.Open("postgres", "postgres://username:password@host/dbname")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ func main() {
|
|||||||
pool := &redis.Pool{
|
pool := &redis.Pool{
|
||||||
MaxIdle: 10,
|
MaxIdle: 10,
|
||||||
Dial: func() (redis.Conn, error) {
|
Dial: func() (redis.Conn, error) {
|
||||||
return redis.Dial("tcp", "localhost:6379")
|
return redis.Dial("tcp", "host:6379")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ Because the token is highly unique, key collisions are not a concern. But if you
|
|||||||
pool := &redis.Pool{
|
pool := &redis.Pool{
|
||||||
MaxIdle: 10,
|
MaxIdle: 10,
|
||||||
Dial: func() (redis.Conn, error) {
|
Dial: func() (redis.Conn, error) {
|
||||||
return redis.Dial("tcp", "localhost:6379")
|
return redis.Dial("tcp", "host:6379")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,10 +70,10 @@ This package provides a background 'cleanup' goroutine to delete expired session
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
// Run a cleanup every 30 minutes.
|
// Run a cleanup every 30 minutes.
|
||||||
SQLite3Store.NewWithCleanupInterval(db, 30*time.Minute)
|
sqlite3store.NewWithCleanupInterval(db, 30*time.Minute)
|
||||||
|
|
||||||
// Disable the cleanup goroutine by setting the cleanup interval to zero.
|
// Disable the cleanup goroutine by setting the cleanup interval to zero.
|
||||||
SQLite3Store.NewWithCleanupInterval(db, 0)
|
sqlite3store.NewWithCleanupInterval(db, 0)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Terminating the Cleanup Goroutine
|
### Terminating the Cleanup Goroutine
|
||||||
@ -90,7 +90,7 @@ func TestExample(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
store := SQLite3Store.New(db)
|
store := sqlite3store.New(db)
|
||||||
defer store.StopCleanup()
|
defer store.StopCleanup()
|
||||||
|
|
||||||
sessionManager = scs.New()
|
sessionManager = scs.New()
|
||||||
|
Reference in New Issue
Block a user