-
Notifications
You must be signed in to change notification settings - Fork 4
/
input.sp
54 lines (53 loc) · 828 Bytes
/
input.sp
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
input "limit" {
width = 2
title = "limit"
type = "combo"
sql = <<EOQ
with limits(label) as (
values
( '20' ),
( '50' ),
( '100' ),
( '200' ),
( '500' ),
( '1000' )
)
select
label,
label::int as value
from
limits
EOQ
}
input "server" {
width = 2
type = "select"
sql = <<EOQ
with data as (
select
server
from
mastodon_toot
where
timeline = 'home'
and reblog_server is not null
limit ${local.limit}
),
counts as (
select
server,
count(*)
from
data
group by
server
)
select
server || ' (' || count || ')' as label,
server as value
from
counts
order by
server
EOQ
}