Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: exportable members #20

Merged
merged 5 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "monitoring"
name = "pragma-monitoring"
version = "0.1.0"
edition = "2021"

Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub(crate) mod config;
pub(crate) mod constants;
pub mod models;
pub mod schema;
pub mod types;
50 changes: 48 additions & 2 deletions src/models.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
extern crate bigdecimal;
extern crate chrono;
// Generated by diesel_ext

#![allow(unused)]
#![allow(clippy::all)]

use bigdecimal::BigDecimal;
use chrono::NaiveDateTime;
use diesel::{Queryable, QueryableByName, Selectable};
use num_bigint::BigInt;
use std::ops::Bound;

#[derive(Debug, Queryable, Selectable, QueryableByName)]
#[diesel(table_name = crate::schema::spot_entry)]
Expand Down Expand Up @@ -43,3 +47,45 @@ pub struct FutureEntry {
pub expiration_timestamp: Option<chrono::NaiveDateTime>,
pub _cursor: i64,
}

#[derive(Queryable, Debug, QueryableByName, Selectable)]
#[diesel(primary_key(data_id))]
#[diesel(check_for_backend(diesel::pg::Pg))]
#[diesel(table_name = crate::schema::spot_checkpoints)]
pub struct SpotCheckpoint {
pub network: String,
pub pair_id: String,
pub data_id: String,
pub block_hash: String,
pub block_number: i64,
pub block_timestamp: NaiveDateTime,
pub transaction_hash: String,
pub price: BigDecimal,
pub sender_address: String,
pub aggregation_mode: BigDecimal,
pub _cursor: i64,
pub timestamp: NaiveDateTime,
pub nb_sources_aggregated: BigDecimal,
}

#[derive(Queryable, Debug, QueryableByName, Selectable)]
#[diesel(primary_key(data_id))]
#[diesel(check_for_backend(diesel::pg::Pg))]
#[diesel(table_name = crate::schema::vrf_requests)]
pub struct VrfRequest {
pub network: String,
pub request_id: BigDecimal,
pub seed: BigDecimal,
pub created_at: NaiveDateTime,
pub created_at_tx: String,
pub callback_address: String,
pub callback_fee_limit: BigDecimal,
pub num_words: BigDecimal,
pub requestor_address: String,
pub updated_at: NaiveDateTime,
pub updated_at_tx: String,
pub status: BigDecimal,
pub minimum_block_number: BigDecimal,
pub _cursor: (Bound<i64>, Bound<i64>),
pub data_id: String,
}
52 changes: 51 additions & 1 deletion src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ diesel::table! {
}

diesel::table! {
spot_entry (timestamp) {
spot_entry (data_id) {
#[max_length = 255]
network -> Varchar,
#[max_length = 255]
Expand All @@ -102,6 +102,54 @@ diesel::table! {
}
}

diesel::table! {
mainnet_spot_checkpoints (pair_id) {
#[max_length = 255]
network -> Varchar,
#[max_length = 255]
pair_id -> Varchar,
#[max_length = 255]
data_id -> Varchar,
#[max_length = 255]
block_hash -> Varchar,
block_number -> Int8,
block_timestamp -> Timestamp,
#[max_length = 255]
transaction_hash -> Varchar,
price -> Numeric,
#[max_length = 255]
sender_address -> Varchar,
aggregation_mode -> Numeric,
_cursor -> Int8,
timestamp -> Timestamp,
nb_sources_aggregated -> Numeric,
}
}

diesel::table! {
spot_checkpoints (data_id) {
#[max_length = 255]
network -> Varchar,
#[max_length = 255]
pair_id -> Varchar,
#[max_length = 255]
data_id -> Varchar,
#[max_length = 255]
block_hash -> Varchar,
block_number -> Int8,
block_timestamp -> Timestamp,
#[max_length = 255]
transaction_hash -> Varchar,
price -> Numeric,
#[max_length = 255]
sender_address -> Varchar,
aggregation_mode -> Numeric,
_cursor -> Int8,
timestamp -> Timestamp,
nb_sources_aggregated -> Numeric,
}
}

diesel::table! {
vrf_requests (data_id) {
#[max_length = 255]
Expand All @@ -127,7 +175,9 @@ diesel::table! {
diesel::allow_tables_to_appear_in_same_query!(
future_entry,
mainnet_future_entry,
mainnet_spot_checkpoints,
mainnet_spot_entry,
spot_checkpoints,
spot_entry,
vrf_requests,
);
Loading