Documentation
¶
Overview ¶
Package dsn data layer storage address method, mainly used for mysql mongodb and other database address
Index ¶
- Variables
- func NewResolvableSelector(selectorName string, extractor ServiceNameExtractor) selector.Selector
- func NewResolvableSelectorWithOpts(selectorName string, opt ...Option) selector.Selector
- type DsnSelector
- type Option
- type Options
- type ResolvableSelector
- type ServiceNameExtractor
- type URIHostExtractor
Constants ¶
This section is empty.
Variables ¶
var DefaultSelector = NewDsnSelector(false)
DefaultSelector dsn default selector
var SeletorName string = "dsn"
SeletorName dsn selector name
Functions ¶
func NewResolvableSelector ¶
func NewResolvableSelector(selectorName string, extractor ServiceNameExtractor) selector.Selector
NewResolvableSelector selector contains address resolution, implemented by other selectors. selectorName is the selector name for address resolution extractor is the func to extract the service name from the dsn, the extracted service name is the parameter of the selector used for address resolution eg: target: mongodb+polaris://user:passwd@poloars_name extractor extract polaris_name from target polaris selector will resolve polaris_name to address
Types ¶
type DsnSelector ¶
type DsnSelector struct {
// contains filtered or unexported fields
}
DsnSelector returns original service name node, with memory cache
func NewDsnSelector ¶ added in v1.1.0
func NewDsnSelector(keepAddrUnresolved bool) *DsnSelector
NewDsnSelector creates a new dsn selector.
type Option ¶ added in v1.1.0
type Option func(*Options)
Option sets ResolvableSelector options.
func WithEnableParseAddr ¶ added in v1.1.0
WithEnableParseAddr ...
func WithExtractor ¶ added in v1.1.0
func WithExtractor(extractor ServiceNameExtractor) Option
WithExtractor ...
type Options ¶ added in v1.1.0
type Options struct { Extractor ServiceNameExtractor EnableParseAddr bool }
Options are ResolvableSelector options.
type ResolvableSelector ¶
type ResolvableSelector struct { EnableParseAddr bool // contains filtered or unexported fields }
ResolvableSelector dsn-selector with address resolver
type ServiceNameExtractor ¶
ServiceNameExtractor extracts the part of the service name in the dsn, and return the starting position and length
type URIHostExtractor ¶
type URIHostExtractor struct { }
URIHostExtractor extracts host from URI, used for ip resolve(like get ip from polaris), work with ResolvableSelector