rpgpie-certificate-store 0.0.2

Certificate store for rpgpie, based on openpgp-cert-d
Documentation
// SPDX-FileCopyrightText: Heiko Schaefer <heiko@schaefer.name>
// SPDX-License-Identifier: MIT OR Apache-2.0

use diesel::prelude::*;

use crate::schema::*;

#[derive(Debug, Queryable, Selectable, Identifiable, AsChangeset)]
pub struct Cert {
    pub id: i32,
    pub fp: String,
    pub cached_tag: Option<String>,
    pub needs_cache_update: bool,
}

#[derive(Insertable)]
#[diesel(table_name = certs)]
pub struct NewCert<'a> {
    pub fp: &'a str,
    pub cached_tag: Option<&'a str>,
    pub needs_cache_update: bool,
}

#[derive(Debug, Queryable, Selectable, Identifiable)]
pub struct Subkey {
    pub id: i32,
    pub fp: String,
    pub cert_id: i32,
}

#[derive(Insertable)]
#[diesel(table_name = subkeys)]
pub struct NewSubkey<'a> {
    pub fp: &'a str,
    pub cert_id: i32,
}

#[derive(Debug, Queryable, Selectable, Identifiable)]
pub struct Keyid {
    pub id: i32,
    pub keyid: String,
    pub cert_id: i32,
}

#[derive(Insertable)]
#[diesel(table_name = keyids)]
pub struct NewKeyid<'a> {
    pub keyid: &'a str,
    pub cert_id: i32,
}

#[derive(Debug, Queryable, Selectable, Identifiable)]
pub struct Email {
    pub id: i32,
    pub email: String,
    pub cert_id: i32,
}

#[derive(Insertable)]
#[diesel(table_name = emails)]
pub struct NewEmail<'a> {
    pub email: &'a str,
    pub cert_id: i32,
}

#[derive(Debug, Queryable, Selectable, Identifiable)]
pub struct Userid {
    pub id: i32,
    pub userid: String,
    pub cert_id: i32,
}

#[derive(Insertable)]
#[diesel(table_name = userids)]
pub struct NewUserid<'a> {
    pub userid: &'a str,
    pub cert_id: i32,
}