change bindings.ml to syntax.ml

This commit is contained in:
Swrup 2022-03-31 00:01:52 +02:00
parent b9d95522a1
commit b718eae11b
6 changed files with 9 additions and 9 deletions

View file

@ -1,5 +1,5 @@
open Db open Db
include Bindings open Syntax
type moderation_action = type moderation_action =
| Ignore | Ignore

View file

@ -29,7 +29,7 @@ let find_comrades =
"SELECT from_id, to_id FROM msg WHERE from_id=? OR to_id=?" "SELECT from_id, to_id FROM msg WHERE from_id=? OR to_id=?"
in in
fun user_id -> fun user_id ->
let open Bindings in let open Syntax in
let^ comrades = Db.Db.collect_list find_comrades (user_id, user_id) in let^ comrades = Db.Db.collect_list find_comrades (user_id, user_id) in
let comrades = let comrades =
List.map (fun (l, r) -> if l = user_id then r else l) comrades List.map (fun (l, r) -> if l = user_id then r else l) comrades
@ -46,7 +46,7 @@ let find_messages =
(from_id=? AND to_id=?)" (from_id=? AND to_id=?)"
in in
fun k1 k2 -> fun k1 k2 ->
let open Bindings in let open Syntax in
let^ comrades = Db.Db.collect_list find_messages ((k1, k2), (k2, k1)) in let^ comrades = Db.Db.collect_list find_messages ((k1, k2), (k2, k1)) in
Ok comrades Ok comrades
@ -63,7 +63,7 @@ let render request =
| Error e -> Template_utils.render_unsafe e request | Error e -> Template_utils.render_unsafe e request
| Ok comrades -> ( | Ok comrades -> (
let comrades = let comrades =
Bindings.unwrap_list Syntax.unwrap_list
(fun id -> (fun id ->
match User.get_nick id with match User.get_nick id with
| Error _e as e -> e | Error _e as e -> e
@ -140,7 +140,7 @@ let insert_msg =
"INSERT INTO msg VALUES (NULL, ?, ?, ?);" "INSERT INTO msg VALUES (NULL, ?, ?, ?);"
in in
fun from_id to_id msg -> fun from_id to_id msg ->
let open Bindings in let open Syntax in
let^ () = Db.Db.exec insert_msg (from_id, to_id, msg) in let^ () = Db.Db.exec insert_msg (from_id, to_id, msg) in
Ok () Ok ()

View file

@ -4,7 +4,6 @@
app app
babillard babillard
babillard_page babillard_page
bindings
catalog_page catalog_page
content content
db db
@ -15,6 +14,7 @@
pp_babillard pp_babillard
register register
report_page report_page
syntax
template template
template_utils template_utils
thread_page thread_page

View file

@ -1,5 +1,5 @@
include Bindings open Syntax
include Babillard open Babillard
open Db open Db
let pp_post fmt t = let pp_post fmt t =

View file

@ -1,4 +1,4 @@
include Bindings open Syntax
open Db open Db
type t = type t =