File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 1
1
package graphdb
2
2
3
3
import (
4
+ "fmt"
5
+
4
6
"github.com/lightningnetwork/lnd/sqldb"
5
7
)
6
8
@@ -37,9 +39,21 @@ var _ V1Store = (*SQLStore)(nil)
37
39
38
40
// NewSQLStore creates a new SQLStore instance given an open BatchedSQLQueries
39
41
// storage backend.
40
- func NewSQLStore (db BatchedSQLQueries , kvStore * KVStore ) * SQLStore {
42
+ func NewSQLStore (db BatchedSQLQueries , kvStore * KVStore ,
43
+ options ... StoreOptionModifier ) (* SQLStore , error ) {
44
+
45
+ opts := DefaultOptions ()
46
+ for _ , o := range options {
47
+ o (opts )
48
+ }
49
+
50
+ if opts .NoMigration {
51
+ return nil , fmt .Errorf ("the NoMigration option is not yet " +
52
+ "supported for SQL stores" )
53
+ }
54
+
41
55
return & SQLStore {
42
56
db : db ,
43
57
KVStore : kvStore ,
44
- }
58
+ }, nil
45
59
}
Original file line number Diff line number Diff line change @@ -38,5 +38,8 @@ func NewTestDB(t testing.TB) V1Store {
38
38
},
39
39
)
40
40
41
- return NewSQLStore (executor , graphStore )
41
+ store , err := NewSQLStore (executor , graphStore )
42
+ require .NoError (t , err )
43
+
44
+ return store
42
45
}
Original file line number Diff line number Diff line change @@ -31,5 +31,8 @@ func NewTestDB(t testing.TB) V1Store {
31
31
},
32
32
)
33
33
34
- return NewSQLStore (executor , graphStore )
34
+ store , err := NewSQLStore (executor , graphStore )
35
+ require .NoError (t , err )
36
+
37
+ return store
35
38
}
You can’t perform that action at this time.
0 commit comments