MCPcopy
hub / github.com/go-sql-driver/mysql / RegisterDialContext

Function RegisterDialContext

driver.go:49–56  ·  view source on GitHub ↗

RegisterDialContext registers a custom dial function. It can then be used by the network address mynet(addr), where mynet is the registered new network. The current context for the connection and its address is passed to the dial function.

(net string, dial DialContextFunc)

Source from the content-addressed store, hash-verified

47// network address mynet(addr), where mynet is the registered new network.
48// The current context for the connection and its address is passed to the dial function.
49func RegisterDialContext(net string, dial DialContextFunc) {
50 dialsLock.Lock()
51 defer dialsLock.Unlock()
52 if dials == nil {
53 dials = make(map[string]DialContextFunc)
54 }
55 dials[net] = dial
56}
57
58// DeregisterDialContext removes the custom dial function registered with the given net.
59func DeregisterDialContext(net string) {

Callers 6

RegisterDialFunction · 0.85
testDialErrorFunction · 0.85
TestCustomDialFunction · 0.85

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by 5

testDialErrorFunction · 0.68
TestCustomDialFunction · 0.68