+15
.sqlx/query-00452ebb198c69e6b83cb5f805007eb92d87b64f1c8c28cf908f695ed82f3408.json
+15
.sqlx/query-00452ebb198c69e6b83cb5f805007eb92d87b64f1c8c28cf908f695ed82f3408.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "INSERT INTO blocks (cid, data) VALUES ($1, $2) ON CONFLICT (cid) DO NOTHING",
4
+
"describe": {
5
+
"columns": [],
6
+
"parameters": {
7
+
"Left": [
8
+
"Bytea",
9
+
"Bytea"
10
+
]
11
+
},
12
+
"nullable": []
13
+
},
14
+
"hash": "00452ebb198c69e6b83cb5f805007eb92d87b64f1c8c28cf908f695ed82f3408"
15
+
}
+17
.sqlx/query-1ea62c689410d98faa70a5a6075911a8eeed679b0e3d7bbd103732abc912f45e.json
+17
.sqlx/query-1ea62c689410d98faa70a5a6075911a8eeed679b0e3d7bbd103732abc912f45e.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "INSERT INTO records (repo_id, collection, rkey, record_cid) VALUES ($1, $2, $3, $4)\n ON CONFLICT (repo_id, collection, rkey) DO UPDATE SET record_cid = $4, created_at = NOW()",
4
+
"describe": {
5
+
"columns": [],
6
+
"parameters": {
7
+
"Left": [
8
+
"Uuid",
9
+
"Text",
10
+
"Text",
11
+
"Text"
12
+
]
13
+
},
14
+
"nullable": []
15
+
},
16
+
"hash": "1ea62c689410d98faa70a5a6075911a8eeed679b0e3d7bbd103732abc912f45e"
17
+
}
+30
.sqlx/query-243ff4911a7d36354e60005af13f6c7d854dc48b8c0d3674f3cbdfd60b61c9d1.json
+30
.sqlx/query-243ff4911a7d36354e60005af13f6c7d854dc48b8c0d3674f3cbdfd60b61c9d1.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT rkey, record_cid FROM records WHERE repo_id = $1 AND collection = $2 ORDER BY rkey ASC LIMIT $3",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "rkey",
9
+
"type_info": "Text"
10
+
},
11
+
{
12
+
"ordinal": 1,
13
+
"name": "record_cid",
14
+
"type_info": "Text"
15
+
}
16
+
],
17
+
"parameters": {
18
+
"Left": [
19
+
"Uuid",
20
+
"Text",
21
+
"Int8"
22
+
]
23
+
},
24
+
"nullable": [
25
+
false,
26
+
false
27
+
]
28
+
},
29
+
"hash": "243ff4911a7d36354e60005af13f6c7d854dc48b8c0d3674f3cbdfd60b61c9d1"
30
+
}
+15
.sqlx/query-2588479ef83ed45a5d0dee599636f195ca38c5df164e225dcb1b829b497c8f14.json
+15
.sqlx/query-2588479ef83ed45a5d0dee599636f195ca38c5df164e225dcb1b829b497c8f14.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "UPDATE repos SET repo_root_cid = $1 WHERE user_id = $2",
4
+
"describe": {
5
+
"columns": [],
6
+
"parameters": {
7
+
"Left": [
8
+
"Text",
9
+
"Uuid"
10
+
]
11
+
},
12
+
"nullable": []
13
+
},
14
+
"hash": "2588479ef83ed45a5d0dee599636f195ca38c5df164e225dcb1b829b497c8f14"
15
+
}
+30
.sqlx/query-2d37a447ec4dbdb6dfd5ab8c12d1ce88b9be04d6c7b4744891352a9a3bed4f3c.json
+30
.sqlx/query-2d37a447ec4dbdb6dfd5ab8c12d1ce88b9be04d6c7b4744891352a9a3bed4f3c.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT rkey, record_cid FROM records WHERE repo_id = $1 AND collection = $2 ORDER BY rkey DESC LIMIT $3",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "rkey",
9
+
"type_info": "Text"
10
+
},
11
+
{
12
+
"ordinal": 1,
13
+
"name": "record_cid",
14
+
"type_info": "Text"
15
+
}
16
+
],
17
+
"parameters": {
18
+
"Left": [
19
+
"Uuid",
20
+
"Text",
21
+
"Int8"
22
+
]
23
+
},
24
+
"nullable": [
25
+
false,
26
+
false
27
+
]
28
+
},
29
+
"hash": "2d37a447ec4dbdb6dfd5ab8c12d1ce88b9be04d6c7b4744891352a9a3bed4f3c"
30
+
}
+31
.sqlx/query-347e3570a201ee339904aab43f0519ff631f160c97453e9e8aef04756cbc424e.json
+31
.sqlx/query-347e3570a201ee339904aab43f0519ff631f160c97453e9e8aef04756cbc424e.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT rkey, record_cid FROM records WHERE repo_id = $1 AND collection = $2 AND rkey > $3 ORDER BY rkey ASC LIMIT $4",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "rkey",
9
+
"type_info": "Text"
10
+
},
11
+
{
12
+
"ordinal": 1,
13
+
"name": "record_cid",
14
+
"type_info": "Text"
15
+
}
16
+
],
17
+
"parameters": {
18
+
"Left": [
19
+
"Uuid",
20
+
"Text",
21
+
"Text",
22
+
"Int8"
23
+
]
24
+
},
25
+
"nullable": [
26
+
false,
27
+
false
28
+
]
29
+
},
30
+
"hash": "347e3570a201ee339904aab43f0519ff631f160c97453e9e8aef04756cbc424e"
31
+
}
+34
.sqlx/query-393066519bf0e1b5b4d2903984001fdd1c17c4cdf8a4af810ce95c05669a04e8.json
+34
.sqlx/query-393066519bf0e1b5b4d2903984001fdd1c17c4cdf8a4af810ce95c05669a04e8.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT id, handle, did FROM users WHERE handle = $1",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "id",
9
+
"type_info": "Uuid"
10
+
},
11
+
{
12
+
"ordinal": 1,
13
+
"name": "handle",
14
+
"type_info": "Text"
15
+
},
16
+
{
17
+
"ordinal": 2,
18
+
"name": "did",
19
+
"type_info": "Text"
20
+
}
21
+
],
22
+
"parameters": {
23
+
"Left": [
24
+
"Text"
25
+
]
26
+
},
27
+
"nullable": [
28
+
false,
29
+
false,
30
+
false
31
+
]
32
+
},
33
+
"hash": "393066519bf0e1b5b4d2903984001fdd1c17c4cdf8a4af810ce95c05669a04e8"
34
+
}
+31
.sqlx/query-4343e751b03e24387f6603908a1582d20fdfa58a8e4c17c1628acc6b6f2ded15.json
+31
.sqlx/query-4343e751b03e24387f6603908a1582d20fdfa58a8e4c17c1628acc6b6f2ded15.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT rkey, record_cid FROM records WHERE repo_id = $1 AND collection = $2 AND rkey < $3 ORDER BY rkey DESC LIMIT $4",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "rkey",
9
+
"type_info": "Text"
10
+
},
11
+
{
12
+
"ordinal": 1,
13
+
"name": "record_cid",
14
+
"type_info": "Text"
15
+
}
16
+
],
17
+
"parameters": {
18
+
"Left": [
19
+
"Uuid",
20
+
"Text",
21
+
"Text",
22
+
"Int8"
23
+
]
24
+
},
25
+
"nullable": [
26
+
false,
27
+
false
28
+
]
29
+
},
30
+
"hash": "4343e751b03e24387f6603908a1582d20fdfa58a8e4c17c1628acc6b6f2ded15"
31
+
}
+46
.sqlx/query-4bc1e1169d95eac340756b1ba01680caa980514d77cc7b41361c2400f6a5f456.json
+46
.sqlx/query-4bc1e1169d95eac340756b1ba01680caa980514d77cc7b41361c2400f6a5f456.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT r.record_cid, r.rkey, r.created_at, u.did, u.handle\n FROM records r\n JOIN repos rp ON r.repo_id = rp.user_id\n JOIN users u ON rp.user_id = u.id\n WHERE u.did = ANY($1) AND r.collection = 'app.bsky.feed.post'\n ORDER BY r.created_at DESC\n LIMIT 50",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "record_cid",
9
+
"type_info": "Text"
10
+
},
11
+
{
12
+
"ordinal": 1,
13
+
"name": "rkey",
14
+
"type_info": "Text"
15
+
},
16
+
{
17
+
"ordinal": 2,
18
+
"name": "created_at",
19
+
"type_info": "Timestamptz"
20
+
},
21
+
{
22
+
"ordinal": 3,
23
+
"name": "did",
24
+
"type_info": "Text"
25
+
},
26
+
{
27
+
"ordinal": 4,
28
+
"name": "handle",
29
+
"type_info": "Text"
30
+
}
31
+
],
32
+
"parameters": {
33
+
"Left": [
34
+
"TextArray"
35
+
]
36
+
},
37
+
"nullable": [
38
+
false,
39
+
false,
40
+
false,
41
+
false,
42
+
false
43
+
]
44
+
},
45
+
"hash": "4bc1e1169d95eac340756b1ba01680caa980514d77cc7b41361c2400f6a5f456"
46
+
}
+22
.sqlx/query-63c2b1ecdc078446f8bd898a7c6403c7e64918027933d0a99eae6175bf0ea0ac.json
+22
.sqlx/query-63c2b1ecdc078446f8bd898a7c6403c7e64918027933d0a99eae6175bf0ea0ac.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT DISTINCT collection FROM records WHERE repo_id = $1",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "collection",
9
+
"type_info": "Text"
10
+
}
11
+
],
12
+
"parameters": {
13
+
"Left": [
14
+
"Uuid"
15
+
]
16
+
},
17
+
"nullable": [
18
+
false
19
+
]
20
+
},
21
+
"hash": "63c2b1ecdc078446f8bd898a7c6403c7e64918027933d0a99eae6175bf0ea0ac"
22
+
}
+16
.sqlx/query-8c9297289cb753c8eaa4231ae9eab6cd3367f9bf543d9f49bca4afa53434ce0d.json
+16
.sqlx/query-8c9297289cb753c8eaa4231ae9eab6cd3367f9bf543d9f49bca4afa53434ce0d.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "DELETE FROM records WHERE repo_id = $1 AND collection = $2 AND rkey = $3",
4
+
"describe": {
5
+
"columns": [],
6
+
"parameters": {
7
+
"Left": [
8
+
"Uuid",
9
+
"Text",
10
+
"Text"
11
+
]
12
+
},
13
+
"nullable": []
14
+
},
15
+
"hash": "8c9297289cb753c8eaa4231ae9eab6cd3367f9bf543d9f49bca4afa53434ce0d"
16
+
}
+20
.sqlx/query-bbf600f17712173206b754fd7c8f8f8fd46a03bf54e824ff8046c37a88407123.json
+20
.sqlx/query-bbf600f17712173206b754fd7c8f8f8fd46a03bf54e824ff8046c37a88407123.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT 1 as one",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "one",
9
+
"type_info": "Int4"
10
+
}
11
+
],
12
+
"parameters": {
13
+
"Left": []
14
+
},
15
+
"nullable": [
16
+
null
17
+
]
18
+
},
19
+
"hash": "bbf600f17712173206b754fd7c8f8f8fd46a03bf54e824ff8046c37a88407123"
20
+
}
+17
.sqlx/query-c61fc3b2fbdf6891269908ef21f13dcabdc3b032e9f767becae34ca176df18b6.json
+17
.sqlx/query-c61fc3b2fbdf6891269908ef21f13dcabdc3b032e9f767becae34ca176df18b6.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "INSERT INTO records (repo_id, collection, rkey, record_cid) VALUES ($1, $2, $3, $4)\n ON CONFLICT (repo_id, collection, rkey) DO UPDATE SET record_cid = $4, created_at = NOW()",
4
+
"describe": {
5
+
"columns": [],
6
+
"parameters": {
7
+
"Left": [
8
+
"Uuid",
9
+
"Text",
10
+
"Text",
11
+
"Text"
12
+
]
13
+
},
14
+
"nullable": []
15
+
},
16
+
"hash": "c61fc3b2fbdf6891269908ef21f13dcabdc3b032e9f767becae34ca176df18b6"
17
+
}
+22
.sqlx/query-ce7977cb9183b587a2c2a56b4e5d52a6de786b5d3a05af4c2245fd61b98d0168.json
+22
.sqlx/query-ce7977cb9183b587a2c2a56b4e5d52a6de786b5d3a05af4c2245fd61b98d0168.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT id FROM users WHERE handle = $1",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "id",
9
+
"type_info": "Uuid"
10
+
}
11
+
],
12
+
"parameters": {
13
+
"Left": [
14
+
"Text"
15
+
]
16
+
},
17
+
"nullable": [
18
+
false
19
+
]
20
+
},
21
+
"hash": "ce7977cb9183b587a2c2a56b4e5d52a6de786b5d3a05af4c2245fd61b98d0168"
22
+
}
+22
.sqlx/query-ebceb64378f0e06c61c72d10f65fb7df83e09e82153d92dee4efef62de057505.json
+22
.sqlx/query-ebceb64378f0e06c61c72d10f65fb7df83e09e82153d92dee4efef62de057505.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT data FROM blocks WHERE cid = $1",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "data",
9
+
"type_info": "Bytea"
10
+
}
11
+
],
12
+
"parameters": {
13
+
"Left": [
14
+
"Bytea"
15
+
]
16
+
},
17
+
"nullable": [
18
+
false
19
+
]
20
+
},
21
+
"hash": "ebceb64378f0e06c61c72d10f65fb7df83e09e82153d92dee4efef62de057505"
22
+
}
+24
.sqlx/query-f09c0e92f101ef5abe2579083a26f782946646a8bd813bcd6cc568a6b7fc8f6d.json
+24
.sqlx/query-f09c0e92f101ef5abe2579083a26f782946646a8bd813bcd6cc568a6b7fc8f6d.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT record_cid FROM records WHERE repo_id = $1 AND collection = $2 AND rkey = $3",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "record_cid",
9
+
"type_info": "Text"
10
+
}
11
+
],
12
+
"parameters": {
13
+
"Left": [
14
+
"Uuid",
15
+
"Text",
16
+
"Text"
17
+
]
18
+
},
19
+
"nullable": [
20
+
false
21
+
]
22
+
},
23
+
"hash": "f09c0e92f101ef5abe2579083a26f782946646a8bd813bcd6cc568a6b7fc8f6d"
24
+
}
+22
.sqlx/query-fba80b51dd803209fd2691b07213b68eade7427381a61268d16cb4cac357ac69.json
+22
.sqlx/query-fba80b51dd803209fd2691b07213b68eade7427381a61268d16cb4cac357ac69.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT 1 as one FROM blocks WHERE cid = $1",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "one",
9
+
"type_info": "Int4"
10
+
}
11
+
],
12
+
"parameters": {
13
+
"Left": [
14
+
"Bytea"
15
+
]
16
+
},
17
+
"nullable": [
18
+
null
19
+
]
20
+
},
21
+
"hash": "fba80b51dd803209fd2691b07213b68eade7427381a61268d16cb4cac357ac69"
22
+
}
+34
.sqlx/query-fd1efe850ae4d8b9d834aba414a5b97f20094c790804c60079905b199e9d3858.json
+34
.sqlx/query-fd1efe850ae4d8b9d834aba414a5b97f20094c790804c60079905b199e9d3858.json
···
1
+
{
2
+
"db_name": "PostgreSQL",
3
+
"query": "SELECT id, handle, did FROM users WHERE did = $1",
4
+
"describe": {
5
+
"columns": [
6
+
{
7
+
"ordinal": 0,
8
+
"name": "id",
9
+
"type_info": "Uuid"
10
+
},
11
+
{
12
+
"ordinal": 1,
13
+
"name": "handle",
14
+
"type_info": "Text"
15
+
},
16
+
{
17
+
"ordinal": 2,
18
+
"name": "did",
19
+
"type_info": "Text"
20
+
}
21
+
],
22
+
"parameters": {
23
+
"Left": [
24
+
"Text"
25
+
]
26
+
},
27
+
"nullable": [
28
+
false,
29
+
false,
30
+
false
31
+
]
32
+
},
33
+
"hash": "fd1efe850ae4d8b9d834aba414a5b97f20094c790804c60079905b199e9d3858"
34
+
}
-353
Cargo.lock
-353
Cargo.lock
···
28
28
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
29
29
30
30
[[package]]
31
-
name = "adler32"
32
-
version = "1.2.0"
33
-
source = "registry+https://github.com/rust-lang/crates.io-index"
34
-
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
35
-
36
-
[[package]]
37
31
name = "aho-corasick"
38
32
version = "1.1.4"
39
33
source = "registry+https://github.com/rust-lang/crates.io-index"
···
49
43
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
50
44
51
45
[[package]]
52
-
name = "alloc-no-stdlib"
53
-
version = "2.0.4"
54
-
source = "registry+https://github.com/rust-lang/crates.io-index"
55
-
checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3"
56
-
57
-
[[package]]
58
-
name = "alloc-stdlib"
59
-
version = "0.2.2"
60
-
source = "registry+https://github.com/rust-lang/crates.io-index"
61
-
checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece"
62
-
dependencies = [
63
-
"alloc-no-stdlib",
64
-
]
65
-
66
-
[[package]]
67
46
name = "allocator-api2"
68
47
version = "0.2.21"
69
48
source = "registry+https://github.com/rust-lang/crates.io-index"
···
83
62
version = "1.0.100"
84
63
source = "registry+https://github.com/rust-lang/crates.io-index"
85
64
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
86
-
87
-
[[package]]
88
-
name = "ascii"
89
-
version = "1.1.0"
90
-
source = "registry+https://github.com/rust-lang/crates.io-index"
91
-
checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16"
92
65
93
66
[[package]]
94
67
name = "assert-json-diff"
···
695
668
696
669
[[package]]
697
670
name = "base64"
698
-
version = "0.13.1"
699
-
source = "registry+https://github.com/rust-lang/crates.io-index"
700
-
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
701
-
702
-
[[package]]
703
-
name = "base64"
704
671
version = "0.21.7"
705
672
source = "registry+https://github.com/rust-lang/crates.io-index"
706
673
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
···
880
847
]
881
848
882
849
[[package]]
883
-
name = "brotli"
884
-
version = "3.5.0"
885
-
source = "registry+https://github.com/rust-lang/crates.io-index"
886
-
checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391"
887
-
dependencies = [
888
-
"alloc-no-stdlib",
889
-
"alloc-stdlib",
890
-
"brotli-decompressor",
891
-
]
892
-
893
-
[[package]]
894
-
name = "brotli-decompressor"
895
-
version = "2.5.1"
896
-
source = "registry+https://github.com/rust-lang/crates.io-index"
897
-
checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f"
898
-
dependencies = [
899
-
"alloc-no-stdlib",
900
-
"alloc-stdlib",
901
-
]
902
-
903
-
[[package]]
904
850
name = "bspds"
905
851
version = "0.1.0"
906
852
dependencies = [
···
962
908
"cc-traits",
963
909
"slab",
964
910
"smallvec",
965
-
]
966
-
967
-
[[package]]
968
-
name = "buf_redux"
969
-
version = "0.8.4"
970
-
source = "registry+https://github.com/rust-lang/crates.io-index"
971
-
checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f"
972
-
dependencies = [
973
-
"memchr",
974
-
"safemem",
975
911
]
976
912
977
913
[[package]]
···
1073
1009
]
1074
1010
1075
1011
[[package]]
1076
-
name = "cesu8"
1077
-
version = "1.1.0"
1078
-
source = "registry+https://github.com/rust-lang/crates.io-index"
1079
-
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
1080
-
1081
-
[[package]]
1082
1012
name = "cfg-if"
1083
1013
version = "1.0.4"
1084
1014
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1103
1033
"wasm-bindgen",
1104
1034
"windows-link 0.2.1",
1105
1035
]
1106
-
1107
-
[[package]]
1108
-
name = "chunked_transfer"
1109
-
version = "1.5.0"
1110
-
source = "registry+https://github.com/rust-lang/crates.io-index"
1111
-
checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901"
1112
1036
1113
1037
[[package]]
1114
1038
name = "ciborium"
···
1168
1092
checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0"
1169
1093
dependencies = [
1170
1094
"cc",
1171
-
]
1172
-
1173
-
[[package]]
1174
-
name = "combine"
1175
-
version = "4.6.7"
1176
-
source = "registry+https://github.com/rust-lang/crates.io-index"
1177
-
checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd"
1178
-
dependencies = [
1179
-
"bytes",
1180
-
"memchr",
1181
1095
]
1182
1096
1183
1097
[[package]]
···
1523
1437
checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b"
1524
1438
1525
1439
[[package]]
1526
-
name = "deflate"
1527
-
version = "1.0.0"
1528
-
source = "registry+https://github.com/rust-lang/crates.io-index"
1529
-
checksum = "c86f7e25f518f4b81808a2cf1c50996a61f5c2eb394b2393bd87f2a4780a432f"
1530
-
dependencies = [
1531
-
"adler32",
1532
-
"gzip-header",
1533
-
]
1534
-
1535
-
[[package]]
1536
1440
name = "der"
1537
1441
version = "0.6.1"
1538
1442
source = "registry+https://github.com/rust-lang/crates.io-index"
···
2202
2106
"ff 0.13.1",
2203
2107
"rand_core 0.6.4",
2204
2108
"subtle",
2205
-
]
2206
-
2207
-
[[package]]
2208
-
name = "gzip-header"
2209
-
version = "1.0.0"
2210
-
source = "registry+https://github.com/rust-lang/crates.io-index"
2211
-
checksum = "95cc527b92e6029a62960ad99aa8a6660faa4555fe5f731aab13aa6a921795a2"
2212
-
dependencies = [
2213
-
"crc32fast",
2214
2109
]
2215
2110
2216
2111
[[package]]
···
3100
2995
"miette",
3101
2996
"p256 0.13.2",
3102
2997
"rand 0.8.5",
3103
-
"rouille",
3104
2998
"serde",
3105
2999
"serde_html_form",
3106
3000
"serde_json",
···
3110
3004
"tokio",
3111
3005
"trait-variant",
3112
3006
"url",
3113
-
"webbrowser",
3114
3007
]
3115
3008
3116
3009
[[package]]
···
3141
3034
]
3142
3035
3143
3036
[[package]]
3144
-
name = "jni"
3145
-
version = "0.21.1"
3146
-
source = "registry+https://github.com/rust-lang/crates.io-index"
3147
-
checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"
3148
-
dependencies = [
3149
-
"cesu8",
3150
-
"cfg-if",
3151
-
"combine",
3152
-
"jni-sys",
3153
-
"log",
3154
-
"thiserror 1.0.69",
3155
-
"walkdir",
3156
-
"windows-sys 0.45.0",
3157
-
]
3158
-
3159
-
[[package]]
3160
-
name = "jni-sys"
3161
-
version = "0.3.0"
3162
-
source = "registry+https://github.com/rust-lang/crates.io-index"
3163
-
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
3164
-
3165
-
[[package]]
3166
3037
name = "jobserver"
3167
3038
version = "0.1.34"
3168
3039
source = "registry+https://github.com/rust-lang/crates.io-index"
···
3481
3352
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
3482
3353
3483
3354
[[package]]
3484
-
name = "mime_guess"
3485
-
version = "2.0.5"
3486
-
source = "registry+https://github.com/rust-lang/crates.io-index"
3487
-
checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
3488
-
dependencies = [
3489
-
"mime",
3490
-
"unicase",
3491
-
]
3492
-
3493
-
[[package]]
3494
3355
name = "mini-moka"
3495
3356
version = "0.10.3"
3496
3357
source = "registry+https://github.com/rust-lang/crates.io-index"
···
3556
3417
]
3557
3418
3558
3419
[[package]]
3559
-
name = "multipart"
3560
-
version = "0.18.0"
3561
-
source = "registry+https://github.com/rust-lang/crates.io-index"
3562
-
checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182"
3563
-
dependencies = [
3564
-
"buf_redux",
3565
-
"httparse",
3566
-
"log",
3567
-
"mime",
3568
-
"mime_guess",
3569
-
"quick-error",
3570
-
"rand 0.8.5",
3571
-
"safemem",
3572
-
"tempfile",
3573
-
"twoway",
3574
-
]
3575
-
3576
-
[[package]]
3577
3420
name = "n0-future"
3578
3421
version = "0.1.3"
3579
3422
source = "registry+https://github.com/rust-lang/crates.io-index"
···
3610
3453
"security-framework-sys",
3611
3454
"tempfile",
3612
3455
]
3613
-
3614
-
[[package]]
3615
-
name = "ndk-context"
3616
-
version = "0.1.1"
3617
-
source = "registry+https://github.com/rust-lang/crates.io-index"
3618
-
checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
3619
3456
3620
3457
[[package]]
3621
3458
name = "new_debug_unreachable"
···
3749
3586
]
3750
3587
3751
3588
[[package]]
3752
-
name = "num_threads"
3753
-
version = "0.1.7"
3754
-
source = "registry+https://github.com/rust-lang/crates.io-index"
3755
-
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
3756
-
dependencies = [
3757
-
"libc",
3758
-
]
3759
-
3760
-
[[package]]
3761
-
name = "objc2"
3762
-
version = "0.6.3"
3763
-
source = "registry+https://github.com/rust-lang/crates.io-index"
3764
-
checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05"
3765
-
dependencies = [
3766
-
"objc2-encode",
3767
-
]
3768
-
3769
-
[[package]]
3770
-
name = "objc2-encode"
3771
-
version = "4.1.0"
3772
-
source = "registry+https://github.com/rust-lang/crates.io-index"
3773
-
checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
3774
-
3775
-
[[package]]
3776
-
name = "objc2-foundation"
3777
-
version = "0.3.2"
3778
-
source = "registry+https://github.com/rust-lang/crates.io-index"
3779
-
checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
3780
-
dependencies = [
3781
-
"bitflags",
3782
-
"objc2",
3783
-
]
3784
-
3785
-
[[package]]
3786
3589
name = "once_cell"
3787
3590
version = "1.21.3"
3788
3591
source = "registry+https://github.com/rust-lang/crates.io-index"
···
4228
4031
]
4229
4032
4230
4033
[[package]]
4231
-
name = "quick-error"
4232
-
version = "1.2.3"
4233
-
source = "registry+https://github.com/rust-lang/crates.io-index"
4234
-
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
4235
-
4236
-
[[package]]
4237
4034
name = "quinn"
4238
4035
version = "0.11.9"
4239
4036
source = "registry+https://github.com/rust-lang/crates.io-index"
···
4522
4319
]
4523
4320
4524
4321
[[package]]
4525
-
name = "rouille"
4526
-
version = "3.6.2"
4527
-
source = "registry+https://github.com/rust-lang/crates.io-index"
4528
-
checksum = "3716fbf57fc1084d7a706adf4e445298d123e4a44294c4e8213caf1b85fcc921"
4529
-
dependencies = [
4530
-
"base64 0.13.1",
4531
-
"brotli",
4532
-
"chrono",
4533
-
"deflate",
4534
-
"filetime",
4535
-
"multipart",
4536
-
"percent-encoding",
4537
-
"rand 0.8.5",
4538
-
"serde",
4539
-
"serde_derive",
4540
-
"serde_json",
4541
-
"sha1_smol",
4542
-
"threadpool",
4543
-
"time",
4544
-
"tiny_http",
4545
-
"url",
4546
-
]
4547
-
4548
-
[[package]]
4549
4322
name = "rsa"
4550
4323
version = "0.9.9"
4551
4324
source = "registry+https://github.com/rust-lang/crates.io-index"
···
4706
4479
version = "1.0.20"
4707
4480
source = "registry+https://github.com/rust-lang/crates.io-index"
4708
4481
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
4709
-
4710
-
[[package]]
4711
-
name = "safemem"
4712
-
version = "0.3.3"
4713
-
source = "registry+https://github.com/rust-lang/crates.io-index"
4714
-
checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
4715
4482
4716
4483
[[package]]
4717
4484
name = "same-file"
···
5010
4777
"cpufeatures",
5011
4778
"digest",
5012
4779
]
5013
-
5014
-
[[package]]
5015
-
name = "sha1_smol"
5016
-
version = "1.0.1"
5017
-
source = "registry+https://github.com/rust-lang/crates.io-index"
5018
-
checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
5019
4780
5020
4781
[[package]]
5021
4782
name = "sha2"
···
5674
5435
]
5675
5436
5676
5437
[[package]]
5677
-
name = "threadpool"
5678
-
version = "1.8.1"
5679
-
source = "registry+https://github.com/rust-lang/crates.io-index"
5680
-
checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa"
5681
-
dependencies = [
5682
-
"num_cpus",
5683
-
]
5684
-
5685
-
[[package]]
5686
5438
name = "time"
5687
5439
version = "0.3.44"
5688
5440
source = "registry+https://github.com/rust-lang/crates.io-index"
···
5690
5442
dependencies = [
5691
5443
"deranged",
5692
5444
"itoa",
5693
-
"libc",
5694
5445
"num-conv",
5695
-
"num_threads",
5696
5446
"powerfmt",
5697
5447
"serde",
5698
5448
"time-core",
···
5713
5463
dependencies = [
5714
5464
"num-conv",
5715
5465
"time-core",
5716
-
]
5717
-
5718
-
[[package]]
5719
-
name = "tiny_http"
5720
-
version = "0.12.0"
5721
-
source = "registry+https://github.com/rust-lang/crates.io-index"
5722
-
checksum = "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82"
5723
-
dependencies = [
5724
-
"ascii",
5725
-
"chunked_transfer",
5726
-
"httpdate",
5727
-
"log",
5728
5466
]
5729
5467
5730
5468
[[package]]
···
6010
5748
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
6011
5749
6012
5750
[[package]]
6013
-
name = "twoway"
6014
-
version = "0.1.8"
6015
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6016
-
checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1"
6017
-
dependencies = [
6018
-
"memchr",
6019
-
]
6020
-
6021
-
[[package]]
6022
5751
name = "typenum"
6023
5752
version = "1.19.0"
6024
5753
source = "registry+https://github.com/rust-lang/crates.io-index"
···
6316
6045
dependencies = [
6317
6046
"js-sys",
6318
6047
"wasm-bindgen",
6319
-
]
6320
-
6321
-
[[package]]
6322
-
name = "webbrowser"
6323
-
version = "1.0.6"
6324
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6325
-
checksum = "00f1243ef785213e3a32fa0396093424a3a6ea566f9948497e5a2309261a4c97"
6326
-
dependencies = [
6327
-
"core-foundation 0.10.1",
6328
-
"jni",
6329
-
"log",
6330
-
"ndk-context",
6331
-
"objc2",
6332
-
"objc2-foundation",
6333
-
"url",
6334
-
"web-sys",
6335
6048
]
6336
6049
6337
6050
[[package]]
···
6563
6276
6564
6277
[[package]]
6565
6278
name = "windows-sys"
6566
-
version = "0.45.0"
6567
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6568
-
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
6569
-
dependencies = [
6570
-
"windows-targets 0.42.2",
6571
-
]
6572
-
6573
-
[[package]]
6574
-
name = "windows-sys"
6575
6279
version = "0.48.0"
6576
6280
source = "registry+https://github.com/rust-lang/crates.io-index"
6577
6281
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
···
6608
6312
6609
6313
[[package]]
6610
6314
name = "windows-targets"
6611
-
version = "0.42.2"
6612
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6613
-
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
6614
-
dependencies = [
6615
-
"windows_aarch64_gnullvm 0.42.2",
6616
-
"windows_aarch64_msvc 0.42.2",
6617
-
"windows_i686_gnu 0.42.2",
6618
-
"windows_i686_msvc 0.42.2",
6619
-
"windows_x86_64_gnu 0.42.2",
6620
-
"windows_x86_64_gnullvm 0.42.2",
6621
-
"windows_x86_64_msvc 0.42.2",
6622
-
]
6623
-
6624
-
[[package]]
6625
-
name = "windows-targets"
6626
6315
version = "0.48.5"
6627
6316
source = "registry+https://github.com/rust-lang/crates.io-index"
6628
6317
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
···
6680
6369
6681
6370
[[package]]
6682
6371
name = "windows_aarch64_gnullvm"
6683
-
version = "0.42.2"
6684
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6685
-
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
6686
-
6687
-
[[package]]
6688
-
name = "windows_aarch64_gnullvm"
6689
6372
version = "0.48.5"
6690
6373
source = "registry+https://github.com/rust-lang/crates.io-index"
6691
6374
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
···
6704
6387
6705
6388
[[package]]
6706
6389
name = "windows_aarch64_msvc"
6707
-
version = "0.42.2"
6708
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6709
-
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
6710
-
6711
-
[[package]]
6712
-
name = "windows_aarch64_msvc"
6713
6390
version = "0.48.5"
6714
6391
source = "registry+https://github.com/rust-lang/crates.io-index"
6715
6392
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
···
6725
6402
version = "0.53.1"
6726
6403
source = "registry+https://github.com/rust-lang/crates.io-index"
6727
6404
checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
6728
-
6729
-
[[package]]
6730
-
name = "windows_i686_gnu"
6731
-
version = "0.42.2"
6732
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6733
-
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
6734
6405
6735
6406
[[package]]
6736
6407
name = "windows_i686_gnu"
···
6764
6435
6765
6436
[[package]]
6766
6437
name = "windows_i686_msvc"
6767
-
version = "0.42.2"
6768
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6769
-
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
6770
-
6771
-
[[package]]
6772
-
name = "windows_i686_msvc"
6773
6438
version = "0.48.5"
6774
6439
source = "registry+https://github.com/rust-lang/crates.io-index"
6775
6440
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
···
6788
6453
6789
6454
[[package]]
6790
6455
name = "windows_x86_64_gnu"
6791
-
version = "0.42.2"
6792
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6793
-
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
6794
-
6795
-
[[package]]
6796
-
name = "windows_x86_64_gnu"
6797
6456
version = "0.48.5"
6798
6457
source = "registry+https://github.com/rust-lang/crates.io-index"
6799
6458
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
···
6812
6471
6813
6472
[[package]]
6814
6473
name = "windows_x86_64_gnullvm"
6815
-
version = "0.42.2"
6816
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6817
-
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
6818
-
6819
-
[[package]]
6820
-
name = "windows_x86_64_gnullvm"
6821
6474
version = "0.48.5"
6822
6475
source = "registry+https://github.com/rust-lang/crates.io-index"
6823
6476
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
···
6833
6486
version = "0.53.1"
6834
6487
source = "registry+https://github.com/rust-lang/crates.io-index"
6835
6488
checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
6836
-
6837
-
[[package]]
6838
-
name = "windows_x86_64_msvc"
6839
-
version = "0.42.2"
6840
-
source = "registry+https://github.com/rust-lang/crates.io-index"
6841
-
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
6842
6489
6843
6490
[[package]]
6844
6491
name = "windows_x86_64_msvc"
+1
-1
Cargo.toml
+1
-1
Cargo.toml
···
15
15
chrono = { version = "0.4.42", features = ["serde"] }
16
16
cid = "0.11.1"
17
17
dotenvy = "0.15.7"
18
-
jacquard = "0.9.3"
18
+
jacquard = { version = "0.9.3", default-features = false, features = ["api", "api_bluesky", "api_full", "derive", "dns"] }
19
19
jacquard-axum = "0.9.2"
20
20
jacquard-repo = "0.9.2"
21
21
jsonwebtoken = { version = "10.2.0", features = ["rust_crypto"] }
+11
-23
src/api/feed/timeline.rs
+11
-23
src/api/feed/timeline.rs
···
11
11
use jacquard_repo::storage::BlockStore;
12
12
use serde::Serialize;
13
13
use serde_json::{Value, json};
14
-
use sqlx::Row;
15
14
use tracing::error;
16
15
17
16
#[derive(Serialize)]
···
153
152
.into_response();
154
153
}
155
154
156
-
let placeholders: Vec<String> = followed_dids
157
-
.iter()
158
-
.enumerate()
159
-
.map(|(i, _)| format!("${}", i + 1))
160
-
.collect();
161
-
162
-
let posts_query = format!(
155
+
let posts_result = sqlx::query!(
163
156
"SELECT r.record_cid, r.rkey, r.created_at, u.did, u.handle
164
157
FROM records r
165
158
JOIN repos rp ON r.repo_id = rp.user_id
166
159
JOIN users u ON rp.user_id = u.id
167
-
WHERE u.did IN ({}) AND r.collection = 'app.bsky.feed.post'
160
+
WHERE u.did = ANY($1) AND r.collection = 'app.bsky.feed.post'
168
161
ORDER BY r.created_at DESC
169
162
LIMIT 50",
170
-
placeholders.join(", ")
171
-
);
172
-
173
-
let mut query = sqlx::query(&posts_query);
174
-
for did in &followed_dids {
175
-
query = query.bind(did);
176
-
}
177
-
178
-
let posts_result = query.fetch_all(&state.db).await;
163
+
&followed_dids
164
+
)
165
+
.fetch_all(&state.db)
166
+
.await;
179
167
180
168
let posts = match posts_result {
181
169
Ok(rows) => rows,
···
192
180
let mut feed: Vec<FeedViewPost> = Vec::new();
193
181
194
182
for row in posts {
195
-
let record_cid: String = row.get("record_cid");
196
-
let rkey: String = row.get("rkey");
197
-
let created_at: chrono::DateTime<chrono::Utc> = row.get("created_at");
198
-
let author_did: String = row.get("did");
199
-
let author_handle: String = row.get("handle");
183
+
let record_cid: String = row.record_cid;
184
+
let rkey: String = row.rkey;
185
+
let created_at: chrono::DateTime<chrono::Utc> = row.created_at;
186
+
let author_did: String = row.did;
187
+
let author_handle: String = row.handle;
200
188
201
189
let cid = match record_cid.parse::<cid::Cid>() {
202
190
Ok(c) => c,
+7
-13
src/api/repo/meta.rs
+7
-13
src/api/repo/meta.rs
···
7
7
};
8
8
use serde::Deserialize;
9
9
use serde_json::json;
10
-
use sqlx::Row;
11
10
12
11
#[derive(Deserialize)]
13
12
pub struct DescribeRepoInput {
···
19
18
Query(input): Query<DescribeRepoInput>,
20
19
) -> Response {
21
20
let user_row = if input.repo.starts_with("did:") {
22
-
sqlx::query("SELECT id, handle, did FROM users WHERE did = $1")
23
-
.bind(&input.repo)
21
+
sqlx::query!("SELECT id, handle, did FROM users WHERE did = $1", input.repo)
24
22
.fetch_optional(&state.db)
25
23
.await
24
+
.map(|opt| opt.map(|r| (r.id, r.handle, r.did)))
26
25
} else {
27
-
sqlx::query("SELECT id, handle, did FROM users WHERE handle = $1")
28
-
.bind(&input.repo)
26
+
sqlx::query!("SELECT id, handle, did FROM users WHERE handle = $1", input.repo)
29
27
.fetch_optional(&state.db)
30
28
.await
29
+
.map(|opt| opt.map(|r| (r.id, r.handle, r.did)))
31
30
};
32
31
33
32
let (user_id, handle, did) = match user_row {
34
-
Ok(Some(row)) => (
35
-
row.get::<uuid::Uuid, _>("id"),
36
-
row.get::<String, _>("handle"),
37
-
row.get::<String, _>("did"),
38
-
),
33
+
Ok(Some((id, handle, did))) => (id, handle, did),
39
34
_ => {
40
35
return (
41
36
StatusCode::NOT_FOUND,
···
46
41
};
47
42
48
43
let collections_query =
49
-
sqlx::query("SELECT DISTINCT collection FROM records WHERE repo_id = $1")
50
-
.bind(user_id)
44
+
sqlx::query!("SELECT DISTINCT collection FROM records WHERE repo_id = $1", user_id)
51
45
.fetch_all(&state.db)
52
46
.await;
53
47
54
48
let collections: Vec<String> = match collections_query {
55
-
Ok(rows) => rows.iter().map(|r| r.get("collection")).collect(),
49
+
Ok(rows) => rows.iter().map(|r| r.collection.clone()).collect(),
56
50
Err(_) => Vec::new(),
57
51
};
58
52
+19
-24
src/api/repo/record/batch.rs
+19
-24
src/api/repo/record/batch.rs
···
15
15
use jacquard_repo::{commit::Commit, mst::Mst, storage::BlockStore};
16
16
use serde::{Deserialize, Serialize};
17
17
use serde_json::json;
18
-
use sqlx::Row;
19
18
use std::str::FromStr;
20
19
use std::sync::Arc;
21
20
use tracing::error;
···
90
89
.unwrap_or("")
91
90
.replace("Bearer ", "");
92
91
93
-
let session = sqlx::query(
94
-
"SELECT s.did, k.key_bytes FROM sessions s JOIN users u ON s.did = u.did JOIN user_keys k ON u.id = k.user_id WHERE s.access_jwt = $1"
92
+
let session = sqlx::query!(
93
+
"SELECT s.did, k.key_bytes FROM sessions s JOIN users u ON s.did = u.did JOIN user_keys k ON u.id = k.user_id WHERE s.access_jwt = $1",
94
+
token
95
95
)
96
-
.bind(&token)
97
96
.fetch_optional(&state.db)
98
97
.await
99
98
.unwrap_or(None);
100
99
101
100
let (did, key_bytes) = match session {
102
101
Some(row) => (
103
-
row.get::<String, _>("did"),
104
-
row.get::<Vec<u8>, _>("key_bytes"),
102
+
row.did,
103
+
row.key_bytes,
105
104
),
106
105
None => {
107
106
return (
···
144
143
.into_response();
145
144
}
146
145
147
-
let user_query = sqlx::query("SELECT id FROM users WHERE did = $1")
148
-
.bind(&did)
146
+
let user_query = sqlx::query!("SELECT id FROM users WHERE did = $1", did)
149
147
.fetch_optional(&state.db)
150
148
.await;
151
149
152
150
let user_id: uuid::Uuid = match user_query {
153
-
Ok(Some(row)) => row.get("id"),
151
+
Ok(Some(row)) => row.id,
154
152
_ => {
155
153
return (
156
154
StatusCode::INTERNAL_SERVER_ERROR,
···
160
158
}
161
159
};
162
160
163
-
let repo_root_query = sqlx::query("SELECT repo_root_cid FROM repos WHERE user_id = $1")
164
-
.bind(user_id)
161
+
let repo_root_query = sqlx::query!("SELECT repo_root_cid FROM repos WHERE user_id = $1", user_id)
165
162
.fetch_optional(&state.db)
166
163
.await;
167
164
168
165
let current_root_cid = match repo_root_query {
169
166
Ok(Some(row)) => {
170
-
let cid_str: String = row.get("repo_root_cid");
167
+
let cid_str: String = row.repo_root_cid;
171
168
match Cid::from_str(&cid_str) {
172
169
Ok(c) => c,
173
170
Err(_) => {
···
449
446
}
450
447
};
451
448
452
-
let update_repo = sqlx::query("UPDATE repos SET repo_root_cid = $1 WHERE user_id = $2")
453
-
.bind(new_root_cid.to_string())
454
-
.bind(user_id)
449
+
let update_repo = sqlx::query!("UPDATE repos SET repo_root_cid = $1 WHERE user_id = $2", new_root_cid.to_string(), user_id)
455
450
.execute(&state.db)
456
451
.await;
457
452
···
467
462
for (collection, rkey, record_cid) in record_ops {
468
463
match record_cid {
469
464
Some(cid) => {
470
-
let _ = sqlx::query(
465
+
let _ = sqlx::query!(
471
466
"INSERT INTO records (repo_id, collection, rkey, record_cid) VALUES ($1, $2, $3, $4)
472
467
ON CONFLICT (repo_id, collection, rkey) DO UPDATE SET record_cid = $4, created_at = NOW()",
468
+
user_id,
469
+
collection,
470
+
rkey,
471
+
cid
473
472
)
474
-
.bind(user_id)
475
-
.bind(&collection)
476
-
.bind(&rkey)
477
-
.bind(&cid)
478
473
.execute(&state.db)
479
474
.await;
480
475
}
481
476
None => {
482
-
let _ = sqlx::query(
477
+
let _ = sqlx::query!(
483
478
"DELETE FROM records WHERE repo_id = $1 AND collection = $2 AND rkey = $3",
479
+
user_id,
480
+
collection,
481
+
rkey
484
482
)
485
-
.bind(user_id)
486
-
.bind(&collection)
487
-
.bind(&rkey)
488
483
.execute(&state.db)
489
484
.await;
490
485
}
+11
-19
src/api/repo/record/delete.rs
+11
-19
src/api/repo/record/delete.rs
···
14
14
use jacquard_repo::{commit::Commit, mst::Mst, storage::BlockStore};
15
15
use serde::Deserialize;
16
16
use serde_json::json;
17
-
use sqlx::Row;
18
17
use std::str::FromStr;
19
18
use std::sync::Arc;
20
19
use tracing::error;
···
49
48
.unwrap_or("")
50
49
.replace("Bearer ", "");
51
50
52
-
let session = sqlx::query(
53
-
"SELECT s.did, k.key_bytes FROM sessions s JOIN users u ON s.did = u.did JOIN user_keys k ON u.id = k.user_id WHERE s.access_jwt = $1"
51
+
let session = sqlx::query!(
52
+
"SELECT s.did, k.key_bytes FROM sessions s JOIN users u ON s.did = u.did JOIN user_keys k ON u.id = k.user_id WHERE s.access_jwt = $1",
53
+
token
54
54
)
55
-
.bind(&token)
56
55
.fetch_optional(&state.db)
57
56
.await
58
57
.unwrap_or(None);
59
58
60
59
let (did, key_bytes) = match session {
61
60
Some(row) => (
62
-
row.get::<String, _>("did"),
63
-
row.get::<Vec<u8>, _>("key_bytes"),
61
+
row.did,
62
+
row.key_bytes,
64
63
),
65
64
None => {
66
65
return (
···
83
82
return (StatusCode::FORBIDDEN, Json(json!({"error": "InvalidRepo", "message": "Repo does not match authenticated user"}))).into_response();
84
83
}
85
84
86
-
let user_query = sqlx::query("SELECT id FROM users WHERE did = $1")
87
-
.bind(&did)
85
+
let user_query = sqlx::query!("SELECT id FROM users WHERE did = $1", did)
88
86
.fetch_optional(&state.db)
89
87
.await;
90
88
91
89
let user_id: uuid::Uuid = match user_query {
92
-
Ok(Some(row)) => row.get("id"),
90
+
Ok(Some(row)) => row.id,
93
91
_ => {
94
92
return (
95
93
StatusCode::INTERNAL_SERVER_ERROR,
···
99
97
}
100
98
};
101
99
102
-
let repo_root_query = sqlx::query("SELECT repo_root_cid FROM repos WHERE user_id = $1")
103
-
.bind(user_id)
100
+
let repo_root_query = sqlx::query!("SELECT repo_root_cid FROM repos WHERE user_id = $1", user_id)
104
101
.fetch_optional(&state.db)
105
102
.await;
106
103
107
104
let current_root_cid = match repo_root_query {
108
105
Ok(Some(row)) => {
109
-
let cid_str: String = row.get("repo_root_cid");
106
+
let cid_str: String = row.repo_root_cid;
110
107
Cid::from_str(&cid_str).ok()
111
108
}
112
109
_ => None,
···
209
206
}
210
207
};
211
208
212
-
let update_repo = sqlx::query("UPDATE repos SET repo_root_cid = $1 WHERE user_id = $2")
213
-
.bind(new_root_cid.to_string())
214
-
.bind(user_id)
209
+
let update_repo = sqlx::query!("UPDATE repos SET repo_root_cid = $1 WHERE user_id = $2", new_root_cid.to_string(), user_id)
215
210
.execute(&state.db)
216
211
.await;
217
212
···
225
220
}
226
221
227
222
let record_delete =
228
-
sqlx::query("DELETE FROM records WHERE repo_id = $1 AND collection = $2 AND rkey = $3")
229
-
.bind(user_id)
230
-
.bind(&input.collection)
231
-
.bind(&input.rkey)
223
+
sqlx::query!("DELETE FROM records WHERE repo_id = $1 AND collection = $2 AND rkey = $3", user_id, input.collection, input.rkey)
232
224
.execute(&state.db)
233
225
.await;
234
226
+68
-45
src/api/repo/record/read.rs
+68
-45
src/api/repo/record/read.rs
···
9
9
use jacquard_repo::storage::BlockStore;
10
10
use serde::{Deserialize, Serialize};
11
11
use serde_json::json;
12
-
use sqlx::Row;
13
12
use std::str::FromStr;
14
13
use tracing::error;
15
14
···
25
24
State(state): State<AppState>,
26
25
Query(input): Query<GetRecordInput>,
27
26
) -> Response {
28
-
let user_row = if input.repo.starts_with("did:") {
29
-
sqlx::query("SELECT id FROM users WHERE did = $1")
30
-
.bind(&input.repo)
27
+
let user_id_opt = if input.repo.starts_with("did:") {
28
+
sqlx::query!("SELECT id FROM users WHERE did = $1", input.repo)
31
29
.fetch_optional(&state.db)
32
30
.await
31
+
.map(|opt| opt.map(|r| r.id))
33
32
} else {
34
-
sqlx::query("SELECT id FROM users WHERE handle = $1")
35
-
.bind(&input.repo)
33
+
sqlx::query!("SELECT id FROM users WHERE handle = $1", input.repo)
36
34
.fetch_optional(&state.db)
37
35
.await
36
+
.map(|opt| opt.map(|r| r.id))
38
37
};
39
38
40
-
let user_id: uuid::Uuid = match user_row {
41
-
Ok(Some(row)) => row.get("id"),
39
+
let user_id: uuid::Uuid = match user_id_opt {
40
+
Ok(Some(id)) => id,
42
41
_ => {
43
42
return (
44
43
StatusCode::NOT_FOUND,
···
48
47
}
49
48
};
50
49
51
-
let record_row = sqlx::query(
50
+
let record_row = sqlx::query!(
52
51
"SELECT record_cid FROM records WHERE repo_id = $1 AND collection = $2 AND rkey = $3",
52
+
user_id,
53
+
input.collection,
54
+
input.rkey
53
55
)
54
-
.bind(user_id)
55
-
.bind(&input.collection)
56
-
.bind(&input.rkey)
57
56
.fetch_optional(&state.db)
58
57
.await;
59
58
60
59
let record_cid_str: String = match record_row {
61
-
Ok(Some(row)) => row.get("record_cid"),
60
+
Ok(Some(row)) => row.record_cid,
62
61
_ => {
63
62
return (
64
63
StatusCode::NOT_FOUND,
···
143
142
State(state): State<AppState>,
144
143
Query(input): Query<ListRecordsInput>,
145
144
) -> Response {
146
-
let user_row = if input.repo.starts_with("did:") {
147
-
sqlx::query("SELECT id FROM users WHERE did = $1")
148
-
.bind(&input.repo)
145
+
let user_id_opt = if input.repo.starts_with("did:") {
146
+
sqlx::query!("SELECT id FROM users WHERE did = $1", input.repo)
149
147
.fetch_optional(&state.db)
150
148
.await
149
+
.map(|opt| opt.map(|r| r.id))
151
150
} else {
152
-
sqlx::query("SELECT id FROM users WHERE handle = $1")
153
-
.bind(&input.repo)
151
+
sqlx::query!("SELECT id FROM users WHERE handle = $1", input.repo)
154
152
.fetch_optional(&state.db)
155
153
.await
154
+
.map(|opt| opt.map(|r| r.id))
156
155
};
157
156
158
-
let user_id: uuid::Uuid = match user_row {
159
-
Ok(Some(row)) => row.get("id"),
157
+
let user_id: uuid::Uuid = match user_id_opt {
158
+
Ok(Some(id)) => id,
160
159
_ => {
161
160
return (
162
161
StatusCode::NOT_FOUND,
···
172
171
// Simplistic query construction - no sophisticated cursor handling or rkey ranges for now, just basic pagination
173
172
// TODO: Implement rkeyStart/End and correct cursor logic
174
173
175
-
let query_str = format!(
176
-
"SELECT rkey, record_cid FROM records WHERE repo_id = $1 AND collection = $2 {} ORDER BY rkey {} LIMIT {}",
177
-
if let Some(_c) = &input.cursor {
178
-
if reverse {
179
-
"AND rkey < $3"
180
-
} else {
181
-
"AND rkey > $3"
182
-
}
174
+
let limit_i64 = limit as i64;
175
+
let rows_res = if let Some(cursor) = &input.cursor {
176
+
if reverse {
177
+
sqlx::query!(
178
+
"SELECT rkey, record_cid FROM records WHERE repo_id = $1 AND collection = $2 AND rkey < $3 ORDER BY rkey DESC LIMIT $4",
179
+
user_id,
180
+
input.collection,
181
+
cursor,
182
+
limit_i64
183
+
)
184
+
.fetch_all(&state.db)
185
+
.await
186
+
.map(|rows| rows.into_iter().map(|r| (r.rkey, r.record_cid)).collect::<Vec<_>>())
187
+
} else {
188
+
sqlx::query!(
189
+
"SELECT rkey, record_cid FROM records WHERE repo_id = $1 AND collection = $2 AND rkey > $3 ORDER BY rkey ASC LIMIT $4",
190
+
user_id,
191
+
input.collection,
192
+
cursor,
193
+
limit_i64
194
+
)
195
+
.fetch_all(&state.db)
196
+
.await
197
+
.map(|rows| rows.into_iter().map(|r| (r.rkey, r.record_cid)).collect::<Vec<_>>())
198
+
}
199
+
} else {
200
+
if reverse {
201
+
sqlx::query!(
202
+
"SELECT rkey, record_cid FROM records WHERE repo_id = $1 AND collection = $2 ORDER BY rkey DESC LIMIT $3",
203
+
user_id,
204
+
input.collection,
205
+
limit_i64
206
+
)
207
+
.fetch_all(&state.db)
208
+
.await
209
+
.map(|rows| rows.into_iter().map(|r| (r.rkey, r.record_cid)).collect::<Vec<_>>())
183
210
} else {
184
-
""
185
-
},
186
-
if reverse { "DESC" } else { "ASC" },
187
-
limit
188
-
);
189
-
190
-
let mut query = sqlx::query(&query_str)
191
-
.bind(user_id)
192
-
.bind(&input.collection);
193
-
194
-
if let Some(c) = &input.cursor {
195
-
query = query.bind(c);
196
-
}
211
+
sqlx::query!(
212
+
"SELECT rkey, record_cid FROM records WHERE repo_id = $1 AND collection = $2 ORDER BY rkey ASC LIMIT $3",
213
+
user_id,
214
+
input.collection,
215
+
limit_i64
216
+
)
217
+
.fetch_all(&state.db)
218
+
.await
219
+
.map(|rows| rows.into_iter().map(|r| (r.rkey, r.record_cid)).collect::<Vec<_>>())
220
+
}
221
+
};
197
222
198
-
let rows = match query.fetch_all(&state.db).await {
223
+
let rows = match rows_res {
199
224
Ok(r) => r,
200
225
Err(e) => {
201
226
error!("Error listing records: {:?}", e);
···
210
235
let mut records = Vec::new();
211
236
let mut last_rkey = None;
212
237
213
-
for row in rows {
214
-
let rkey: String = row.get("rkey");
215
-
let cid_str: String = row.get("record_cid");
238
+
for (rkey, cid_str) in rows {
216
239
last_rkey = Some(rkey.clone());
217
240
218
241
if let Ok(cid) = Cid::from_str(&cid_str) {
+30
-39
src/api/repo/record/write.rs
+30
-39
src/api/repo/record/write.rs
···
15
15
use jacquard_repo::{commit::Commit, mst::Mst, storage::BlockStore};
16
16
use serde::{Deserialize, Serialize};
17
17
use serde_json::json;
18
-
use sqlx::Row;
19
18
use std::str::FromStr;
20
19
use std::sync::Arc;
21
20
use tracing::error;
···
58
57
.unwrap_or("")
59
58
.replace("Bearer ", "");
60
59
61
-
let session = sqlx::query(
62
-
"SELECT s.did, k.key_bytes FROM sessions s JOIN users u ON s.did = u.did JOIN user_keys k ON u.id = k.user_id WHERE s.access_jwt = $1"
60
+
let session = sqlx::query!(
61
+
"SELECT s.did, k.key_bytes FROM sessions s JOIN users u ON s.did = u.did JOIN user_keys k ON u.id = k.user_id WHERE s.access_jwt = $1",
62
+
token
63
63
)
64
-
.bind(&token)
65
64
.fetch_optional(&state.db)
66
65
.await
67
66
.unwrap_or(None);
68
67
69
68
let (did, key_bytes) = match session {
70
69
Some(row) => (
71
-
row.get::<String, _>("did"),
72
-
row.get::<Vec<u8>, _>("key_bytes"),
70
+
row.did,
71
+
row.key_bytes,
73
72
),
74
73
None => {
75
74
return (
···
92
91
return (StatusCode::FORBIDDEN, Json(json!({"error": "InvalidRepo", "message": "Repo does not match authenticated user"}))).into_response();
93
92
}
94
93
95
-
let user_query = sqlx::query("SELECT id FROM users WHERE did = $1")
96
-
.bind(&did)
94
+
let user_query = sqlx::query!("SELECT id FROM users WHERE did = $1", did)
97
95
.fetch_optional(&state.db)
98
96
.await;
99
97
100
98
let user_id: uuid::Uuid = match user_query {
101
-
Ok(Some(row)) => row.get("id"),
99
+
Ok(Some(row)) => row.id,
102
100
_ => {
103
101
return (
104
102
StatusCode::INTERNAL_SERVER_ERROR,
···
108
106
}
109
107
};
110
108
111
-
let repo_root_query = sqlx::query("SELECT repo_root_cid FROM repos WHERE user_id = $1")
112
-
.bind(user_id)
109
+
let repo_root_query = sqlx::query!("SELECT repo_root_cid FROM repos WHERE user_id = $1", user_id)
113
110
.fetch_optional(&state.db)
114
111
.await;
115
112
116
113
let current_root_cid = match repo_root_query {
117
114
Ok(Some(row)) => {
118
-
let cid_str: String = row.get("repo_root_cid");
115
+
let cid_str: String = row.repo_root_cid;
119
116
Cid::from_str(&cid_str).ok()
120
117
}
121
118
_ => None,
···
280
277
}
281
278
};
282
279
283
-
let update_repo = sqlx::query("UPDATE repos SET repo_root_cid = $1 WHERE user_id = $2")
284
-
.bind(new_root_cid.to_string())
285
-
.bind(user_id)
280
+
let update_repo = sqlx::query!("UPDATE repos SET repo_root_cid = $1 WHERE user_id = $2", new_root_cid.to_string(), user_id)
286
281
.execute(&state.db)
287
282
.await;
288
283
···
295
290
.into_response();
296
291
}
297
292
298
-
let record_insert = sqlx::query(
293
+
let record_insert = sqlx::query!(
299
294
"INSERT INTO records (repo_id, collection, rkey, record_cid) VALUES ($1, $2, $3, $4)
300
295
ON CONFLICT (repo_id, collection, rkey) DO UPDATE SET record_cid = $4, created_at = NOW()",
296
+
user_id,
297
+
input.collection,
298
+
rkey,
299
+
record_cid.to_string()
301
300
)
302
-
.bind(user_id)
303
-
.bind(&input.collection)
304
-
.bind(&rkey)
305
-
.bind(record_cid.to_string())
306
301
.execute(&state.db)
307
302
.await;
308
303
···
362
357
.unwrap_or("")
363
358
.replace("Bearer ", "");
364
359
365
-
let session = sqlx::query(
366
-
"SELECT s.did, k.key_bytes FROM sessions s JOIN users u ON s.did = u.did JOIN user_keys k ON u.id = k.user_id WHERE s.access_jwt = $1"
360
+
let session = sqlx::query!(
361
+
"SELECT s.did, k.key_bytes FROM sessions s JOIN users u ON s.did = u.did JOIN user_keys k ON u.id = k.user_id WHERE s.access_jwt = $1",
362
+
token
367
363
)
368
-
.bind(&token)
369
364
.fetch_optional(&state.db)
370
365
.await
371
366
.unwrap_or(None);
372
367
373
368
let (did, key_bytes) = match session {
374
369
Some(row) => (
375
-
row.get::<String, _>("did"),
376
-
row.get::<Vec<u8>, _>("key_bytes"),
370
+
row.did,
371
+
row.key_bytes,
377
372
),
378
373
None => {
379
374
return (
···
396
391
return (StatusCode::FORBIDDEN, Json(json!({"error": "InvalidRepo", "message": "Repo does not match authenticated user"}))).into_response();
397
392
}
398
393
399
-
let user_query = sqlx::query("SELECT id FROM users WHERE did = $1")
400
-
.bind(&did)
394
+
let user_query = sqlx::query!("SELECT id FROM users WHERE did = $1", did)
401
395
.fetch_optional(&state.db)
402
396
.await;
403
397
404
398
let user_id: uuid::Uuid = match user_query {
405
-
Ok(Some(row)) => row.get("id"),
399
+
Ok(Some(row)) => row.id,
406
400
_ => {
407
401
return (
408
402
StatusCode::INTERNAL_SERVER_ERROR,
···
412
406
}
413
407
};
414
408
415
-
let repo_root_query = sqlx::query("SELECT repo_root_cid FROM repos WHERE user_id = $1")
416
-
.bind(user_id)
409
+
let repo_root_query = sqlx::query!("SELECT repo_root_cid FROM repos WHERE user_id = $1", user_id)
417
410
.fetch_optional(&state.db)
418
411
.await;
419
412
420
413
let current_root_cid = match repo_root_query {
421
414
Ok(Some(row)) => {
422
-
let cid_str: String = row.get("repo_root_cid");
415
+
let cid_str: String = row.repo_root_cid;
423
416
Cid::from_str(&cid_str).ok()
424
417
}
425
418
_ => None,
···
637
630
}
638
631
};
639
632
640
-
let update_repo = sqlx::query("UPDATE repos SET repo_root_cid = $1 WHERE user_id = $2")
641
-
.bind(new_root_cid.to_string())
642
-
.bind(user_id)
633
+
let update_repo = sqlx::query!("UPDATE repos SET repo_root_cid = $1 WHERE user_id = $2", new_root_cid.to_string(), user_id)
643
634
.execute(&state.db)
644
635
.await;
645
636
···
652
643
.into_response();
653
644
}
654
645
655
-
let record_insert = sqlx::query(
646
+
let record_insert = sqlx::query!(
656
647
"INSERT INTO records (repo_id, collection, rkey, record_cid) VALUES ($1, $2, $3, $4)
657
648
ON CONFLICT (repo_id, collection, rkey) DO UPDATE SET record_cid = $4, created_at = NOW()",
649
+
user_id,
650
+
input.collection,
651
+
rkey,
652
+
record_cid.to_string()
658
653
)
659
-
.bind(user_id)
660
-
.bind(&input.collection)
661
-
.bind(&rkey)
662
-
.bind(record_cid.to_string())
663
654
.execute(&state.db)
664
655
.await;
665
656