...
1 package dbal
2
3 import (
4 "regexp"
5 )
6
7 const (
8 SQLiteInMemory = "sqlite://file::memory:?_fk=true"
9 SQLiteSharedInMemory = "sqlite://file::memory:?_fk=true&cache=shared"
10 )
11
12 var dsnRegex = regexp.MustCompile(`^(sqlite://file:(?:.+)\?((\w+=\w+)(&\w+=\w+)*)?(&?mode=memory)(&\w+=\w+)*)$|(?:sqlite://(file:)?:memory:(?:\?\w+=\w+)?(?:&\w+=\w+)*)|^(?:(?::memory:)|(?:memory))$`)
13
14
15
16
17
18
19 func IsMemorySQLite(dsn string) bool {
20 return dsnRegex.MatchString(dsn)
21 }
22
View as plain text