mirror of
https://github.com/astaxie/beego.git
synced 2024-11-21 17:10:55 +00:00
Merge pull request #4249 from flycash/rft/moveSession
move core/session to web/session
This commit is contained in:
commit
ff762b561c
@ -37,7 +37,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/astaxie/beego/pkg/adapter/session"
|
||||
beecb "github.com/astaxie/beego/pkg/core/session/couchbase"
|
||||
beecb "github.com/astaxie/beego/pkg/server/web/session/couchbase"
|
||||
)
|
||||
|
||||
// SessionStore store each session
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/astaxie/beego/pkg/adapter/session"
|
||||
beeLedis "github.com/astaxie/beego/pkg/core/session/ledis"
|
||||
beeLedis "github.com/astaxie/beego/pkg/server/web/session/ledis"
|
||||
)
|
||||
|
||||
// SessionStore ledis session store
|
||||
|
@ -38,7 +38,7 @@ import (
|
||||
|
||||
"github.com/astaxie/beego/pkg/adapter/session"
|
||||
|
||||
beemem "github.com/astaxie/beego/pkg/core/session/memcache"
|
||||
beemem "github.com/astaxie/beego/pkg/server/web/session/memcache"
|
||||
)
|
||||
|
||||
// SessionStore memcache session store
|
||||
|
@ -45,7 +45,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/astaxie/beego/pkg/adapter/session"
|
||||
"github.com/astaxie/beego/pkg/core/session/mysql"
|
||||
"github.com/astaxie/beego/pkg/server/web/session/mysql"
|
||||
|
||||
// import mysql driver
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
|
@ -58,7 +58,7 @@ import (
|
||||
// import postgresql Driver
|
||||
_ "github.com/lib/pq"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session/postgres"
|
||||
"github.com/astaxie/beego/pkg/server/web/session/postgres"
|
||||
)
|
||||
|
||||
// SessionStore postgresql session store
|
||||
|
@ -17,7 +17,7 @@ package session
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
type oldToNewProviderAdapter struct {
|
||||
|
@ -38,7 +38,7 @@ import (
|
||||
|
||||
"github.com/astaxie/beego/pkg/adapter/session"
|
||||
|
||||
beeRedis "github.com/astaxie/beego/pkg/core/session/redis"
|
||||
beeRedis "github.com/astaxie/beego/pkg/server/web/session/redis"
|
||||
)
|
||||
|
||||
// MaxPoolSize redis max pool size
|
||||
|
@ -37,7 +37,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/astaxie/beego/pkg/adapter/session"
|
||||
cluster "github.com/astaxie/beego/pkg/core/session/redis_cluster"
|
||||
cluster "github.com/astaxie/beego/pkg/server/web/session/redis_cluster"
|
||||
)
|
||||
|
||||
// MaxPoolSize redis_cluster max pool size
|
||||
|
@ -38,7 +38,7 @@ import (
|
||||
|
||||
"github.com/astaxie/beego/pkg/adapter/session"
|
||||
|
||||
sentinel "github.com/astaxie/beego/pkg/core/session/redis_sentinel"
|
||||
sentinel "github.com/astaxie/beego/pkg/server/web/session/redis_sentinel"
|
||||
)
|
||||
|
||||
// DefaultPoolSize redis_sentinel default pool size
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
// CookieSessionStore Cookie SessionStore
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
// FileSessionStore File session store
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
// MemSessionStore memory session store.
|
||||
|
@ -15,7 +15,7 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
// EncodeGob encode the obj to gob
|
||||
|
@ -32,7 +32,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
// Store contains all data for one session process with specific id.
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/astaxie/beego/pkg/adapter/session"
|
||||
|
||||
beeSsdb "github.com/astaxie/beego/pkg/core/session/ssdb"
|
||||
beeSsdb "github.com/astaxie/beego/pkg/server/web/session/ssdb"
|
||||
)
|
||||
|
||||
// Provider holds ssdb client and configs
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
type NewToOldStoreAdapter struct {
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
"github.com/astaxie/beego/pkg"
|
||||
"github.com/astaxie/beego/pkg/core/config"
|
||||
"github.com/astaxie/beego/pkg/core/logs"
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/utils"
|
||||
"github.com/astaxie/beego/pkg/server/web/context"
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
// Regexes for checking the accept headers
|
||||
|
@ -28,7 +28,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
|
||||
"github.com/astaxie/beego/pkg/server/web/context"
|
||||
"github.com/astaxie/beego/pkg/server/web/context/param"
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/logs"
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/context"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
// register MIME type with content type
|
||||
|
@ -40,7 +40,7 @@ import (
|
||||
|
||||
couchbase "github.com/couchbase/go-couchbase"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
var couchbpder = &Provider{}
|
@ -11,7 +11,7 @@ import (
|
||||
"github.com/ledisdb/ledisdb/config"
|
||||
"github.com/ledisdb/ledisdb/ledis"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
var (
|
@ -38,7 +38,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
|
||||
"github.com/bradfitz/gomemcache/memcache"
|
||||
)
|
@ -47,7 +47,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
// import mysql driver
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
)
|
@ -57,7 +57,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
// import postgresql Driver
|
||||
_ "github.com/lib/pq"
|
||||
)
|
@ -40,7 +40,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
|
||||
"github.com/go-redis/redis/v7"
|
||||
)
|
@ -7,7 +7,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
func TestRedis(t *testing.T) {
|
@ -40,7 +40,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
rediss "github.com/go-redis/redis/v7"
|
||||
)
|
||||
|
@ -40,7 +40,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
"github.com/go-redis/redis/v7"
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
func TestRedisSentinel(t *testing.T) {
|
@ -8,8 +8,9 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/astaxie/beego/pkg/core/session"
|
||||
"github.com/ssdb/gossdb/ssdb"
|
||||
|
||||
"github.com/astaxie/beego/pkg/server/web/session"
|
||||
)
|
||||
|
||||
var ssdbProvider = &Provider{}
|
||||
@ -87,7 +88,7 @@ func (p *Provider) SessionExist(ctx context.Context, sid string) (bool, error) {
|
||||
|
||||
// SessionRegenerate regenerate session with new sid and delete oldsid
|
||||
func (p *Provider) SessionRegenerate(ctx context.Context, oldsid, sid string) (session.Store, error) {
|
||||
//conn.Do("setx", key, v, ttl)
|
||||
// conn.Do("setx", key, v, ttl)
|
||||
if p.client == nil {
|
||||
if err := p.connectInit(); err != nil {
|
||||
return nil, err
|
Loading…
Reference in New Issue
Block a user