Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[fix] compiler, database, mongo: Take care of field encoding/decoding…

… for maps
  • Loading branch information...
commit 4a8c34e31f52625946d77eae1d0cf77253b83475 1 parent 764d33d
@BourgerieQuentin BourgerieQuentin authored
View
12 opa/pass_MongoAccessGeneration.ml
@@ -91,14 +91,14 @@ module Generator = struct
in
C.apply gamma annotmap opa2doc [expr]
- let magicToString gamma annotmap expr
+ let expr_to_field gamma annotmap expr
?(ty=QmlAnnotMap.find_ty (Annot.annot (QmlAst.Label.expr expr)) annotmap)
()
=
- let (annotmap, magicToString) =
- OpaMapToIdent.typed_val ~label ~ty:[ty] Opacapi.magicToString annotmap gamma
+ let annotmap, expr_to_field =
+ OpaMapToIdent.typed_val ~label ~ty:[ty] Opacapi.DbMongo.expr_to_field annotmap gamma
in
- C.apply gamma annotmap magicToString [expr]
+ C.apply gamma annotmap expr_to_field [expr]
let add_to_document0 gamma annotmap name expr
?(ty=QmlAnnotMap.find_ty (Annot.annot (QmlAst.Label.expr expr)) annotmap)
@@ -141,7 +141,7 @@ module Generator = struct
let annotmap, d = C.string annotmap "." in
annotmap, d::e::prev_expr
in
- let annotmap, e1 = magicToString gamma annotmap e1 () in
+ let annotmap, e1 = expr_to_field gamma annotmap e1 () in
let annotmap, d1 = C.string annotmap "." in
if q = [] then
let annotmap, value = C.string annotmap "value" in
@@ -740,7 +740,7 @@ module Generator = struct
| DbAst.Query (DbAst.QEq uexpr , _)->
DbAst.SId (uexpr, select),
(fun ((annotmap, expr), dty) ->
-
+
post ((annotmap, expr), dty)
)
View
1  opacapi/opacapi.ml
@@ -163,6 +163,7 @@ struct
let option = !! "option"
let read = !! "read"
let write = !! "write"
+ let expr_to_field = !! "expr_to_field"
end
module DbSet =
View
2  stdlib/database/mongo/db.opa
@@ -911,4 +911,4 @@ DbSet = {{
@opacapi DbSet_build_rpath_collection = DbSet.build_rpath_collection
@opacapi DbSet_default = Option.default
@opacapi DbSet_empty = {empty}
-
+@opacapi DbMongo_expr_to_field(x) = %%BslMongo.Mongo.encode_field%%(OpaSerialize.serialize(x))

0 comments on commit 4a8c34e

Please sign in to comment.
Something went wrong with that request. Please try again.