mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-26 03:52:12 +02:00
383f28faeb
* fix(selector): set global do not work * fix(selector): test * fix(selector): return early * fix(selector): use struct * fix(selector): use struct
22 lines
500 B
Go
22 lines
500 B
Go
package selector
|
|
|
|
var globalSelector = &wrapSelector{}
|
|
|
|
var _ Builder = (*wrapSelector)(nil)
|
|
|
|
// wrapSelector wrapped Selector, help override global Selector implementation.
|
|
type wrapSelector struct{ Builder }
|
|
|
|
// GlobalSelector returns global selector builder.
|
|
func GlobalSelector() Builder {
|
|
if globalSelector.Builder != nil {
|
|
return globalSelector
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetGlobalSelector set global selector builder.
|
|
func SetGlobalSelector(builder Builder) {
|
|
globalSelector.Builder = builder
|
|
}
|