1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-10 21:45:57 +00:00
Former-commit-id: fe6305deed00e170bf4d39a12c0644fe686e0a24
This commit is contained in:
Gerasimos (Makis) Maropoulos
2018-10-21 19:20:05 +03:00
parent dbba631df4
commit 3962710d3d
109 changed files with 4383 additions and 2658 deletions

View File

@@ -7,11 +7,11 @@ import (
"sync/atomic"
"time"
"github.com/kataras/golog"
"github.com/kataras/iris/core/errors"
"github.com/kataras/iris/sessions"
"github.com/dgraph-io/badger"
"github.com/kataras/golog"
)
// DefaultFileMode used as the default database's "fileMode"
@@ -144,7 +144,13 @@ func (db *Database) Get(sid string, key string) (value interface{}) {
if err != nil {
return err
}
// item.ValueCopy
// return item.Value(func(valueBytes []byte) {
// if err := sessions.DefaultTranscoder.Unmarshal(valueBytes, &value); err != nil {
// golog.Error(err)
// }
// })
valueBytes, err := item.Value()
if err != nil {
return err
@@ -173,13 +179,25 @@ func (db *Database) Visit(sid string, cb func(key string, value interface{})) {
for iter.Rewind(); iter.ValidForPrefix(prefix); iter.Next() {
item := iter.Item()
var value interface{}
// err := item.Value(func(valueBytes []byte) {
// if err := sessions.DefaultTranscoder.Unmarshal(valueBytes, &value); err != nil {
// golog.Error(err)
// }
// })
// if err != nil {
// golog.Error(err)
// continue
// }
valueBytes, err := item.Value()
if err != nil {
golog.Error(err)
continue
}
var value interface{}
if err = sessions.DefaultTranscoder.Unmarshal(valueBytes, &value); err != nil {
golog.Error(err)
continue

View File

@@ -6,10 +6,11 @@ import (
"runtime"
"time"
"github.com/coreos/bbolt"
"github.com/kataras/golog"
"github.com/kataras/iris/core/errors"
"github.com/kataras/iris/sessions"
bolt "github.com/etcd-io/bbolt"
"github.com/kataras/golog"
)
// DefaultFileMode used as the default database's "fileMode"