Implement initial login functionality
This commit is contained in:
parent
a3bd0db78c
commit
3aa79b0d23
36 changed files with 908 additions and 70 deletions
24
pkg/cancel/values.go
Normal file
24
pkg/cancel/values.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package cancel
|
||||
|
||||
import "context"
|
||||
|
||||
// ValuesOf returns a new context that has the same deadline and cancelation behviour as parent.
|
||||
// However when requesting values from the context, checks the values in context first.
|
||||
func ValuesOf(parent, values context.Context) context.Context {
|
||||
return &valuesOf{
|
||||
Context: parent,
|
||||
values: values,
|
||||
}
|
||||
}
|
||||
|
||||
type valuesOf struct {
|
||||
context.Context
|
||||
values context.Context
|
||||
}
|
||||
|
||||
func (vv *valuesOf) Value(key any) any {
|
||||
if value := vv.values.Value(key); value != nil {
|
||||
return value
|
||||
}
|
||||
return vv.Context.Value(key)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue