pub struct Database<T = Client> { /* private fields */ }
Expand description

Database wrapper

This precompiles statements and offers wrappers for all mutations and queries. The wrappers are partly automatically generated by the statements! macro.

Implementations§

source§

impl Database<Transaction<'_>>

source

pub async fn builder_register( &self, uuid: Uuid, pubkey: i64 ) -> Result<(), Error>

Register new builder by SSH pubkey and comment.

source

pub async fn fingerprint_add( &self, pubkey: i64, fingerprint: &str ) -> Result<(), Error>

Add a fingerprint to a registered builder.

source

pub async fn builder_set_enabled( &self, uuid: Uuid, enabled: bool ) -> Result<(), Error>

Set builder enabled

source

pub async fn builder_set_comment( &self, uuid: Uuid, commend: &str ) -> Result<(), Error>

Set builder comment

source

pub async fn builder_triple_add( &self, builder: Uuid, triple: &str ) -> Result<(), Error>

Add an allowed triple for a builder

source

pub async fn builder_triple_remove( &self, builder: Uuid, triple: &str ) -> Result<(), Error>

Remove an allowed triple for a builder

source

pub async fn builder_request( &self, builder: Uuid, triple: &str ) -> Result<(), Error>

Request a job for a builder.

source

pub async fn triple_add(&self, name: &str) -> Result<(), Error>

Create a new triple

source

pub async fn triple_remove(&self, name: &str) -> Result<(), Error>

Remove a triple

source

pub async fn triple_enabled( &self, name: &str, enabled: bool ) -> Result<(), Error>

Set triple enabled or disabled

source

pub async fn triple_rename(&self, triple: &str, name: &str) -> Result<(), Error>

Set triple enabled or disabled

source

pub async fn crate_add(&self, name: &str) -> Result<(), Error>

Add a crate to the database.

source

pub async fn crate_version_add( &self, krate: &str, version: &str, url: &str, checksum: &str, yanked: bool ) -> Result<(), Error>

Add a crate version to the database.

source

pub async fn job_stage(&self, job: Uuid, stage: &str) -> Result<(), Error>

Set the job’s current stage.

source

pub async fn job_log(&self, job: Uuid, line: &str) -> Result<(), Error>

Add a log message for the job.

source§

impl<T: GenericClient> Database<T>

source

pub async fn builder_lookup(&self, fingerprint: &str) -> Result<Uuid, Error>

source

pub async fn builder_get(&self, builder: Uuid) -> Result<Builder, Error>

source

pub async fn builder_list(&self) -> Result<Vec<Uuid>, Error>

source

pub async fn builder_triples( &self, builder: Uuid ) -> Result<BTreeSet<String>, Error>

source

pub async fn triple_list(&self) -> Result<BTreeSet<String>, Error>

source

pub async fn triple_info(&self, triple: &str) -> Result<TargetInfo, Error>

source

pub async fn task_list( &self, krate: Option<&str>, version: Option<&str>, task: Option<&str>, triple: Option<&str> ) -> Result<Vec<Task>, Error>

source

pub async fn job_request(&self, builder: Uuid) -> Result<Uuid, Error>

source

pub async fn job_info(&self, job: Uuid) -> Result<JobInfo, Error>

source

pub async fn crate_list(&self, name: &str) -> Result<Vec<String>, Error>

Get info on a crate

source

pub async fn crate_info(&self, name: &str) -> Result<CrateInfo, Error>

Get info on a crate

source

pub async fn crate_versions(&self, name: &str) -> Result<Vec<String>, Error>

Get a list of versions for a crate

source

pub async fn crate_version_info( &self, name: &str, version: &str ) -> Result<VersionInfo, Error>

Get info on a crate version

source§

impl Database<Client>

source

pub async fn new(connection: Client) -> Result<Self, Error>

Create new Database from Postgres [Client].

This will prepare all of the statements that are used.

source

pub async fn connect(database: &str) -> Result<Self, Error>

Connect to database.

source

pub async fn transaction(&mut self) -> Result<Database<Transaction<'_>>, Error>

Create transaction.

source§

impl Database<Transaction<'_>>

source

pub async fn commit(self) -> Result<(), Error>

Commit this transaction.

source

pub async fn builder_add( &self, uuid: Uuid, key: &PublicKey, comment: &str ) -> Result<(), Error>

Add a builder

Trait Implementations§

source§

impl<T: Clone> Clone for Database<T>

source§

fn clone(&self) -> Database<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for Database<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T = Client> !RefUnwindSafe for Database<T>

§

impl<T> Send for Database<T>
where T: Send,

§

impl<T> Sync for Database<T>
where T: Sync,

§

impl<T> Unpin for Database<T>
where T: Unpin,

§

impl<T = Client> !UnwindSafe for Database<T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more