-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcol_query.rb
90 lines (55 loc) · 1.82 KB
/
col_query.rb
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#####
# query ordsub1k.db (sqlite database with first thousand ordinal inscriptions)
$LOAD_PATH.unshift( "../ordlite/lib" )
require 'ordlite'
OrdDb.open( './ord.db' )
puts
puts " #{Inscribe.count} inscribe(s)"
puts " #{Blob.count} blob(s)"
puts " #{Collection.count} collection(s)"
#######################
# sample 1
col = Collection.find_by( name: 'Ordinal Punks' )
inscribes = col.inscribes
puts " #{inscribes.size} inscribe(s)"
#=> 100 inscribe(s)
inscribes.counts_by_content_type
max = inscribes.maximum( 'num' )
min = inscribes.minimum( 'num' )
puts " range no. #{min} to no. #{max}"
#=> range no. 407 to no. 642
pp inscribes.counts_by_day
pp inscribes.counts_by_hour
pp inscribes.counts_by_block
pp inscribes.counts_by_block_with_timestamp
#############################
# sample 2
col = Collection.find_by( name: 'Bitcoin Shrooms' )
inscribes = col.inscribes
puts " #{inscribes.size} inscribe(s)"
#=> 210 inscribe(s)
pp inscribes.counts_by_content_type
max = inscribes.maximum( 'num' )
min = inscribes.minimum( 'num' )
puts " range no. #{min} to no. #{max}"
#=> range no. 675 to no. 1075
pp inscribes.counts_by_day
pp inscribes.counts_by_hour
pp inscribes.counts_by_block
pp inscribes.counts_by_block_with_timestamp
##############################
# sample 3
col = Collection.find_by( name: 'D.I.Y. Punks' )
inscribes = col.inscribes
puts " #{inscribes.size} inscribe(s)"
#=> 721 inscribe(s)
pp inscribes.counts_by_content_type
max = inscribes.maximum( 'num' )
min = inscribes.minimum( 'num' )
puts " range no. #{min} to no. #{max}"
#=> range no. 9959200 to no. 10286852
pp inscribes.counts_by_day
pp inscribes.counts_by_hour
pp inscribes.counts_by_block
pp inscribes.counts_by_block_with_timestamp
puts "bye"