RegisterLocalFile adds the given file to the file allowlist, so that it can be used by "LOAD DATA LOCAL INFILE ". Alternatively you can allow the use of all local files with the DSN parameter 'allowAllFiles=true' filePath := "/home/gopher/data.csv" mysql.RegisterLocalFile(filePath) err
(filePath string)
| 34 | // if err != nil { |
| 35 | // ... |
| 36 | func RegisterLocalFile(filePath string) { |
| 37 | fileRegisterLock.Lock() |
| 38 | // lazy map init |
| 39 | if fileRegister == nil { |
| 40 | fileRegister = make(map[string]struct{}) |
| 41 | } |
| 42 | |
| 43 | fileRegister[strings.Trim(filePath, `"`)] = struct{}{} |
| 44 | fileRegisterLock.Unlock() |
| 45 | } |
| 46 | |
| 47 | // DeregisterLocalFile removes the given filepath from the allowlist. |
| 48 | func DeregisterLocalFile(filePath string) { |
searching dependent graphs…