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