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

Function RegisterReaderHandler

infile.go:68–77  ·  view source on GitHub ↗

RegisterReaderHandler registers a handler function which is used to receive a io.Reader. The Reader can be used by "LOAD DATA LOCAL INFILE Reader::<name>". If the handler returns a io.ReadCloser Close() is called when the request is finished. mysql.RegisterReaderHandler("data", func() io.Reader {

(name string, handler func() io.Reader)

Source from the content-addressed store, hash-verified

66// if err != nil {
67// ...
68func RegisterReaderHandler(name string, handler func() io.Reader) {
69 readerRegisterLock.Lock()
70 // lazy map init
71 if readerRegister == nil {
72 readerRegister = make(map[string]func() io.Reader)
73 }
74
75 readerRegister[name] = handler
76 readerRegisterLock.Unlock()
77}
78
79// DeregisterReaderHandler removes the ReaderHandler function with
80// the given name from the registry.

Callers 1

TestLoadDataFunction · 0.85

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by 1

TestLoadDataFunction · 0.68