go-sessions icon indicating copy to clipboard operation
go-sessions copied to clipboard

Database interface should accept context.Context for all methods

Open gf3 opened this issue 2 years ago • 0 comments

The Database interface should be duplicated and modified (e.g. DatabaseWithCtx) to support receiving the request context for each method call.

For example:

type Database interface {
	Acquire(sid string, expires time.Duration) LifeTime
	// ...
}

// Should become this ↓
type DatabaseWithCtx interface {
	Acquire(ctx context.Context, sid string, expires time.Duration) LifeTime
	// ...
}

This is important for things like tracing, logging, etc...

gf3 avatar Jul 22 '22 22:07 gf3