File tree 1 file changed +14
-4
lines changed
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -470,12 +470,22 @@ func init() {
470
470
}
471
471
}
472
472
473
+ var cachedVersion struct {
474
+ once sync.Once
475
+ number int
476
+ version string
477
+ sourceID string
478
+ }
479
+
473
480
// Version returns SQLite library version information.
474
481
func Version () (libVersion string , libVersionNumber int , sourceID string ) {
475
- libVersion = C .GoString (C .sqlite3_libversion ())
476
- libVersionNumber = int (C .sqlite3_libversion_number ())
477
- sourceID = C .GoString (C .sqlite3_sourceid ())
478
- return libVersion , libVersionNumber , sourceID
482
+ v := & cachedVersion
483
+ v .once .Do (func () {
484
+ v .number = int (C .sqlite3_libversion_number ())
485
+ v .version = C .GoString (C .sqlite3_libversion ())
486
+ v .sourceID = C .GoString (C .sqlite3_sourceid ())
487
+ })
488
+ return v .version , v .number , v .sourceID
479
489
}
480
490
481
491
const (
You can’t perform that action at this time.
0 commit comments