File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 21
21
readerRegister map [string ]func () io.Reader
22
22
)
23
23
24
- func init () {
25
- fileRegister = make (map [string ]bool )
26
- readerRegister = make (map [string ]func () io.Reader )
27
- }
28
-
29
24
// RegisterLocalFile adds the given file to the file whitelist,
30
25
// so that it can be used by "LOAD DATA LOCAL INFILE <filepath>".
31
26
// Alternatively you can allow the use of all local files with
@@ -38,6 +33,11 @@ func init() {
38
33
// ...
39
34
//
40
35
func RegisterLocalFile (filePath string ) {
36
+ // lazy map init
37
+ if fileRegister == nil {
38
+ fileRegister = make (map [string ]bool )
39
+ }
40
+
41
41
fileRegister [strings .Trim (filePath , `"` )] = true
42
42
}
43
43
@@ -62,6 +62,11 @@ func DeregisterLocalFile(filePath string) {
62
62
// ...
63
63
//
64
64
func RegisterReaderHandler (name string , handler func () io.Reader ) {
65
+ // lazy map init
66
+ if readerRegister == nil {
67
+ readerRegister = make (map [string ]func () io.Reader )
68
+ }
69
+
65
70
readerRegister [name ] = handler
66
71
}
67
72
You can’t perform that action at this time.
0 commit comments