Documentation
¶
Overview ¶
Package unwrap finds a concrete driver behind wrapping drivers. Wrappers preserve the original contract in their Unwrap return type; this helper does not use reflection or search arbitrary object graphs.
Example: native, found := unwrap.As[*memorycache.Driver](store.Driver()); fmt.Println(found, native != nil)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func As ¶
As walks driver and the drivers it wraps, following Unwrap() D, and returns the first one of type T. Failure returns T's zero value and false. Wrappers must form an acyclic chain; a typed nil driver is returned if it matches T, like an ordinary type assertion.
if native, found := unwrap.As[*memorycache.Driver](store.Driver()); found {
fmt.Println(native != nil)
}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.