Add function to list GridPropertyDefinitions
Adds a function the the schemas db helpers to list all
Grid Property Definitions.
* -----------------------------------------------------------------------------
*/
-use super::models::{GridSchema, NewGridPropertyDefinition, NewGridSchema};
+use super::models::{GridPropertyDefinition, GridSchema, NewGridPropertyDefinition, NewGridSchema};
use super::schema::{grid_property_definition, grid_schema};
use super::MAX_BLOCK_NUM;
@@ -90,3 +90,12 @@ pub fn list_grid_schemas(conn: &PgConnection) -> QueryResult<Vec<GridSchema>> {
.filter(grid_schema::end_block_num.eq(MAX_BLOCK_NUM))
.load::<GridSchema>(conn)
}
+
+pub fn list_grid_property_definitions(
+ conn: &PgConnection,
+) -> QueryResult<Vec<GridPropertyDefinition>> {
+ grid_property_definition::table
+ .select(grid_property_definition::all_columns)
+ .filter(grid_property_definition::end_block_num.eq(MAX_BLOCK_NUM))
+ .load::<GridPropertyDefinition>(conn)
+}
