-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Closed
Labels
Milestone
Description
Currently when using Scanner, Valuer interface with database/sql, it can't behave differently based on the current context
For example, in a multi-tenant system, each tenant has a different encryption key and would like to save the encrypted value and retrieve the decrypted value automatically.
If we can support ScannerContext and ValuerContext interface in the package database/sql, it would be much easier to implement those cases.
// option 1
type ScannerContext interface {
Scan(ctx context.Context, src interface{}) error
}
type ValuerContext interface {
Value(ctx context.Context) (Value, error)
}
// option 2
type ScannerContext interface {
ScanContext(ctx context.Context, src interface{}) error
}
type ValuerContext interface {
ValueContext(ctx context.Context) (Value, error)
}Mungrel, arp242, gavbaa, shanduur, didip and 15 moretgulacsi