File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed
Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,10 @@ function Crate:sql(sql, bindVars)
3333 local duration = response [" duration" ]
3434
3535 local data = {}
36+ local rows = response [" rows" ]
3637 local columns = response [" cols" ]
3738
38- for j = 1 , # response [ " rows" ] do
39+ for j = 1 , # rows do
3940 local row = response [" rows" ][j ]
4041 local rowData = {}
4142 for k = 1 , # columns do rowData [columns [k ]] = row [k ] end
Original file line number Diff line number Diff line change 11return {
22 up = function ()
3- local transaction = Adb .BeginTransaction ({
3+ local transaction = Adb .primary : BeginTransaction ({
44 collections = {
55 writes = { " some" , " tables" },
66 reads = { " some" , " tables" },
@@ -12,16 +12,16 @@ return {
1212 -- do something
1313 end )
1414 then
15- Adb .CommitTransaction (transaction .result .id )
15+ Adb .primary : CommitTransaction (transaction .result .id )
1616 return true
1717 else
18- Adb .AbortTransaction (transaction .result .id )
18+ Adb .primary : AbortTransaction (transaction .result .id )
1919 return false
2020 end
2121 end ,
2222
2323 down = function ()
24- local transaction = Adb .BeginTransaction ({
24+ local transaction = Adb .primary : BeginTransaction ({
2525 collections = {
2626 writes = { " some" , " tables" },
2727 reads = { " some" , " tables" },
@@ -33,10 +33,10 @@ return {
3333 -- do something
3434 end )
3535 then
36- Adb .CommitTransaction (transaction .result .id )
36+ Adb .primary : CommitTransaction (transaction .result .id )
3737 return true
3838 else
39- Adb .AbortTransaction (transaction .result .id )
39+ Adb .primary : AbortTransaction (transaction .result .id )
4040 return false
4141 end
4242 end ,
Original file line number Diff line number Diff line change 11return {
22 all = function ()
3- return Adb .Aql ([[
3+ return Adb .primary : Aql ([[
44 FOR ##model_singular## IN ##model_plural## SORT ##model_singular##._key ASC RETURN ##model_singular##
55 ]] ).result
66 end ,
77
88 get = function (key )
9- return Adb .GetDocument (" ##model_plural##/" .. key )
9+ return Adb .primary : GetDocument (" ##model_plural##/" .. key )
1010 end ,
1111
1212 create = function (dataset )
13- return Adb .CreateDocument (" ##model_plural##" , dataset )
13+ return Adb .primary : CreateDocument (" ##model_plural##" , dataset )
1414 end ,
1515
1616 update = function (key , dataset )
17- return Adb .UpdateDocument (" ##model_plural##/" .. key , dataset )
17+ return Adb .primary : UpdateDocument (" ##model_plural##/" .. key , dataset )
1818 end ,
1919
2020 destroy = function (key )
21- return Adb .DeleteDocument (" ##model_plural##/" .. key )
21+ return Adb .primary : DeleteDocument (" ##model_plural##/" .. key )
2222 end
2323}
You can’t perform that action at this time.
0 commit comments