2018-11-09 20:02:28 +00:00
|
|
|
// dbx.v1 golang accounting.dbx .
|
|
|
|
|
2018-12-05 14:03:23 +00:00
|
|
|
// 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 = ?
|
|
|
|
)
|
|
|
|
|
2018-11-09 20:02:28 +00:00
|
|
|
model aggregate (
|
|
|
|
key node_id
|
|
|
|
|
|
|
|
field node_id text
|
|
|
|
field start_time timestamp ( updatable )
|
|
|
|
field interval int64 ( updatable )
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
|
|
field updated_at timestamp ( autoinsert, autoupdate )
|
|
|
|
)
|
|
|
|
|
|
|
|
create aggregate ( )
|
|
|
|
update aggregate ( where aggregate.node_id = ? )
|
|
|
|
delete aggregate ( where aggregate.node_id = ? )
|
|
|
|
read one (
|
|
|
|
select aggregate
|
|
|
|
where aggregate.node_id = ?
|
|
|
|
)
|
|
|
|
|
|
|
|
model granular (
|
|
|
|
key node_id
|
|
|
|
|
|
|
|
field node_id text
|
|
|
|
field start_time timestamp ( updatable )
|
|
|
|
field end_time timestamp ( updatable )
|
|
|
|
field data_total int64 ( updatable )
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
|
|
field updated_at timestamp ( autoinsert, autoupdate )
|
|
|
|
)
|
|
|
|
|
|
|
|
create granular ( )
|
|
|
|
update granular ( where granular.node_id = ? )
|
|
|
|
delete granular ( where granular.node_id = ? )
|
|
|
|
read one (
|
|
|
|
select granular
|
|
|
|
where granular.node_id = ?
|
|
|
|
)
|