-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50c6227
commit 9337423
Showing
4 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
use crate::impl_enum_type; | ||
use crate::schema::{ | ||
hw_baseboard_id, inv_caboose, inv_root_of_trust, inv_service_processor, | ||
sw_caboose, | ||
}; | ||
use db_macros::Asset; | ||
use nexus_types::identity::Asset; | ||
use uuid::Uuid; | ||
|
||
impl_enum_type!( | ||
#[derive(SqlType, Debug, QueryId)] | ||
#[diesel(postgres_type(name = "hw_power_state"))] | ||
pub struct HwPowerStateEnum; | ||
|
||
#[derive(Copy, Clone, Debug, AsExpression, FromSqlRow, PartialEq)] | ||
#[diesel(sql_type = HwRotSlotEnum)] | ||
pub enum HwPowerState; | ||
|
||
// Enum values | ||
A0 => b"A0" | ||
A1 => b"A1" | ||
A2 => b"A2" | ||
); | ||
|
||
impl_enum_type!( | ||
#[derive(SqlType, Debug, QueryId)] | ||
#[diesel(postgres_type(name = "hw_rot_slot"))] | ||
pub struct HwRotSlotEnum; | ||
|
||
#[derive(Copy, Clone, Debug, AsExpression, FromSqlRow, PartialEq)] | ||
#[diesel(sql_type = HwRotSlotEnum)] | ||
pub enum HwRotSlot; | ||
|
||
// Enum values | ||
A => b"A" | ||
B => b"B" | ||
); | ||
|
||
impl_enum_type!( | ||
#[derive(SqlType, Debug, QueryId)] | ||
#[diesel(postgres_type(name = "caboose_which"))] | ||
pub struct CabooseWhichEnum; | ||
|
||
#[derive(Copy, Clone, Debug, AsExpression, FromSqlRow, PartialEq)] | ||
#[diesel(sql_type = CabooseWhichEnum)] | ||
pub enum CabooseWhich; | ||
|
||
// Enum values | ||
SpSlot0 => b"sp_slot_0" | ||
SpSlot1 => b"sp_slot_1" | ||
RotSlotA => b"rot_slot_A" | ||
RotSlotB => b"rot_slot_B" | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters