Skip to main content

Branch

Struct Branch 

Source
pub struct Branch {
    pub id: i64,
    pub name: String,
    pub current_operation_hash: Option<HashId>,
    pub remote_name: Option<String>,
}

Fields§

§id: i64§name: String§current_operation_hash: Option<HashId>§remote_name: Option<String>

Implementations§

Source§

impl Branch

Source

pub fn get_or_create(conn: &OperationsConnection, branch_name: &str) -> Branch

Source

pub fn create_with_remote( conn: &OperationsConnection, branch_name: &str, remote_name: Option<&str>, ) -> SQLResult<Branch>

Source

pub fn delete( conn: &OperationsConnection, branch_id: i64, ) -> Result<(), BranchError>

Source

pub fn all(conn: &OperationsConnection) -> Vec<Branch>

Source

pub fn get_by_name( conn: &OperationsConnection, branch_name: &str, ) -> Option<Branch>

Source

pub fn get_by_id(conn: &OperationsConnection, branch_id: i64) -> Option<Branch>

Source

pub fn set_current_operation( conn: &OperationsConnection, branch_id: i64, operation_hash: &HashId, )

Source

pub fn get_operations( conn: &OperationsConnection, branch_id: i64, ) -> Vec<Operation>

Source

pub fn set_remote( conn: &OperationsConnection, branch_id: i64, remote_name: Option<&str>, ) -> SQLResult<()>

Associate a branch with a remote

Source

pub fn set_remote_validated( conn: &OperationsConnection, branch_id: i64, remote_name: Option<&str>, ) -> Result<(), RemoteError>

Associate a branch with a remote with validation

Source

pub fn get_remote(conn: &OperationsConnection, branch_id: i64) -> Option<String>

Get the remote associated with a branch

Trait Implementations§

Source§

impl Clone for Branch

Source§

fn clone(&self) -> Branch

Returns a duplicate 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 Debug for Branch

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Query for Branch

Source§

const TABLE_NAME: &'static str = "branches"

Source§

type Model = Branch

Source§

fn process_row(row: &Row<'_>) -> Self::Model

Source§

const PRIMARY_KEY: &'static str = "id"

Source§

fn query( conn: &Connection, query: &str, params: impl Params, ) -> Vec<Self::Model>

Source§

fn get( conn: &Connection, query: &str, params: impl Params, ) -> Result<Self::Model>

Source§

fn get_by_id<'a, T>(conn: &Connection, id: &'a T) -> Option<Self::Model>
where T: Clone + 'a, Value: From<T>,

Source§

fn query_by_ids<'a, I: ?Sized, T>( conn: &Connection, ids: &'a I, ) -> Vec<Self::Model>
where &'a I: IntoIterator<Item = &'a T>, T: Clone + 'a, Value: From<T>,

Source§

fn delete_by_ids<'a, I: ?Sized, T>( conn: &Connection, ids: &'a I, ) -> Vec<Self::Model>
where &'a I: IntoIterator<Item = &'a T>, T: Clone + 'a, Value: From<T>,

Source§

fn table_name() -> &'static str

Source§

fn all(conn: &Connection) -> Vec<Self::Model>

Source§

fn all_with_limit(conn: &Connection, limit: usize) -> Vec<Self::Model>

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V