6642f97142
* tallies up data stored on each node in pointerdb * adds comments for data type enums * changes Open to BeginTx because Go convention * removes online status check from identify active nodes * changes identifyactivenodes to calculatestaticdata * updates accounting dbx names
64 lines
1.2 KiB
Plaintext
64 lines
1.2 KiB
Plaintext
// dbx.v1 golang accounting.dbx .
|
|
|
|
// timestamps just allows us to save the last time/thing that happened
|
|
model timestamps (
|
|
key name
|
|
|
|
field name text
|
|
field value timestamp ( updatable )
|
|
)
|
|
create timestamps ( )
|
|
update timestamps ( where timestamps.name = ? )
|
|
read scalar (
|
|
select timestamps.value
|
|
where timestamps.name = ?
|
|
)
|
|
|
|
model rollup (
|
|
key id
|
|
|
|
field id serial64
|
|
field node_id text
|
|
field start_time timestamp
|
|
field interval int64
|
|
field data_type int
|
|
field created_at timestamp ( autoinsert )
|
|
field updated_at timestamp ( autoinsert, autoupdate )
|
|
)
|
|
|
|
create rollup ( )
|
|
update rollup ( where rollup.id = ? )
|
|
delete rollup ( where rollup.id = ? )
|
|
read one (
|
|
select rollup
|
|
where rollup.id = ?
|
|
)
|
|
read all (
|
|
select rollup
|
|
where rollup.node_id = ?
|
|
)
|
|
|
|
|
|
model raw (
|
|
key id
|
|
|
|
field id serial64
|
|
field node_id text
|
|
field interval_end_time timestamp
|
|
field data_total int64
|
|
field data_type int
|
|
field created_at timestamp ( autoinsert )
|
|
field updated_at timestamp ( autoinsert, autoupdate )
|
|
)
|
|
|
|
create raw ( )
|
|
update raw ( where raw.id = ? )
|
|
delete raw ( where raw.id = ? )
|
|
read one (
|
|
select raw
|
|
where raw.id = ?
|
|
)
|
|
read all (
|
|
select raw
|
|
where raw.node_id = ?
|
|
) |