Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hackernews Clone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Muhammad Zaki
Hackernews Clone
Commits
0d946cb7
Commit
0d946cb7
authored
2 years ago
by
Muhammad Zaki
Browse files
Options
Downloads
Patches
Plain Diff
chore(server): few type fixes
parent
c1f0cfa6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/server.ml
+9
-6
9 additions, 6 deletions
server/server.ml
with
9 additions
and
6 deletions
server/server.ml
+
9
−
6
View file @
0d946cb7
...
...
@@ -3,18 +3,18 @@ module Comment = struct
end
module
Q
=
struct
open
Caqti_type
.
Std
open
Caqti_request
.
Infix
module
T
=
Caqti_type
.
Std
let
comment
=
let
open
Comment
in
let
encode
{
id
;
message
}
=
Ok
(
id
,
message
)
in
let
decode
(
id
,
message
)
=
Ok
{
id
;
message
}
in
let
rep
=
Caqti_type
.(
tup2
int
string
)
in
custom
~
encode
~
decode
rep
T
.
custom
~
encode
~
decode
rep
let
create_comment
=
(
unit
->.
unit
)
let
open
Caqti_request
.
Infix
in
T
.(
unit
->.
unit
)
@@
{
|
CREATE
TABLE
IF
NOT
EXISTS
comment
(
id
SERIAL
PRIMARY
KEY
,
...
...
@@ -23,9 +23,12 @@ module Q = struct
|
}
let
insert_comment
=
(
string
->.
unit
)
@@
"INSERT INTO comment (text) VALUES ($1)"
let
open
Caqti_request
.
Infix
in
T
.(
string
->.
unit
)
@@
"INSERT INTO comment (text) VALUES ($1)"
let
select_all_comments
=
(
unit
->*
comment
)
@@
"SELECT id, text FROM comment"
let
select_all_comments
=
let
open
Caqti_request
.
Infix
in
T
.(
unit
->*
comment
)
@@
"SELECT id, text FROM comment"
end
let
create_comment
(
module
Db
:
Caqti_lwt
.
CONNECTION
)
=
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment