diff options
Diffstat (limited to 'middleware/session/bbolt.go')
-rw-r--r-- | middleware/session/bbolt.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/middleware/session/bbolt.go b/middleware/session/bbolt.go index be484d7..bf46953 100644 --- a/middleware/session/bbolt.go +++ b/middleware/session/bbolt.go @@ -2,7 +2,6 @@ package session import ( "bytes" - "context" "encoding/gob" "log/slog" @@ -21,8 +20,8 @@ type BoltStore struct { bucketName []byte } -func (s *BoltStore) Load(ctx context.Context, sessionID string) Value { - v := Value{} +func (s *BoltStore) Load(sessionID string) Values { + v := Values{} err := s.db.View(func(tx *bbolt.Tx) error { bucket := tx.Bucket(s.bucketName) if bucket == nil { @@ -39,12 +38,12 @@ func (s *BoltStore) Load(ctx context.Context, sessionID string) Value { return gob.NewDecoder(rdr).Decode(&v) }) if err != nil { - slog.WarnContext(ctx, "failed load session", slog.Any("error", err)) + slog.Warn("failed load session", slog.Any("error", err)) } return v } -func (s *BoltStore) Save(ctx context.Context, sessionID string, value Value) error { +func (s *BoltStore) Save(sessionID string, value Values) error { return s.db.Update(func(tx *bbolt.Tx) error { bucket, err := tx.CreateBucketIfNotExists(s.bucketName) if err != nil { @@ -59,7 +58,7 @@ func (s *BoltStore) Save(ctx context.Context, sessionID string, value Value) err }) } -func (s *BoltStore) Remove(ctx context.Context, sessionID string) error { +func (s *BoltStore) Remove(sessionID string) error { return s.db.Update(func(tx *bbolt.Tx) error { bucket, err := tx.CreateBucketIfNotExists(s.bucketName) if err != nil { |