-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathData.fs
70 lines (56 loc) · 1.46 KB
/
Data.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
namespace SqlFun.NpgSql.Tests
open System
open SqlFun
open Common
module Data =
type PostStatus =
| [<EnumValue("N")>] New = 0
| [<EnumValue("P")>] Published = 1
| [<EnumValue("A")>] Archived = 2
type Comment = {
commentId: int
postId: int
parentId: int option
content: string
author: string
createdAt: DateOnly
creationTime: TimeOnly
}
type Post = {
postId: int
blogId: int
name: string
title: string
content: string
author: string
createdAt: DateOnly
modifiedAt: DateOnly option
modifiedBy: string option
status: PostStatus
}
type Blog = {
blogId: int
name: string
title: string
description: string
owner: string
createdAt: DateOnly
modifiedAt: DateOnly option
modifiedBy: string option
posts: Post list
}
type UserProfile = {
id: string
name: string
email: string
avatar: byte array
}
module Tooling =
let getNumberOfBlogs: IDataContext -> int =
sql "select count(*) from blog"
let deleteAllButFirstBlog: IDataContext -> unit =
sql "delete from blog where blogid > 1"
let deleteAllUsers: IDataContext -> unit =
sql "delete from userprofile"
let deleteAllComments: IDataContext -> unit =
sql "delete from comment"