File tree 2 files changed +15
-4
lines changed
core/js/src/main/scala/porcupine
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,12 @@ private abstract class DatabasePlatform:
52
52
def cursor (args : A ): Resource [F , Cursor [F , B ]] = mutex.lock *>
53
53
Resource
54
54
.eval {
55
- F .delay(statement.iterate(bind(args)* )).map { iterator =>
55
+ val argsList = bind(args)
56
+ val argsDict : js.Dictionary [Any ] =
57
+ js.Dictionary (argsList.zipWithIndex.map { case (v, idx) =>
58
+ (s " ${idx + 1 }" , v)
59
+ }* )
60
+ F .delay(statement.iterate(argsDict)).map { iterator =>
56
61
new :
57
62
def fetch (maxRows : Int ): F [(List [B ], Boolean )] =
58
63
F .delay {
@@ -90,7 +95,12 @@ private abstract class DatabasePlatform:
90
95
new AbstractStatement [F , A , B ]:
91
96
def cursor (args : A ): Resource [F , Cursor [F , B ]] =
92
97
mutex.lock *> Resource .eval {
93
- F .delay(statement.run(bind(args)* )).as(_ => F .pure(Nil , false ))
98
+ val argsList = bind(args)
99
+ val argsDict : js.Dictionary [Any ] =
100
+ js.Dictionary (argsList.zipWithIndex.map { case (v, idx) =>
101
+ (s " ${idx + 1 }" , v)
102
+ }* )
103
+ F .delay(statement.run(argsDict)).as(_ => F .pure(Nil , false ))
94
104
}
95
105
96
106
}
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ private[porcupine] trait Statement extends js.Object:
37
37
38
38
def raw (toggleState : Boolean ): Statement = js.native
39
39
40
- def iterate (bindParameters : Any * ): js.Iterator [js.UndefOr [js.Array [Any ]]] = js.native
40
+ def iterate (bindParameters : js.Dictionary [Any ]): js.Iterator [js.UndefOr [js.Array [Any ]]] =
41
+ js.native
41
42
42
- def run (bindParameters : Any * ): js.Object = js.native
43
+ def run (bindParameters : js. Dictionary [ Any ] ): js.Object = js.native
You can’t perform that action at this time.
0 commit comments