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
impl Branch
pub fn get_or_create(conn: &OperationsConnection, branch_name: &str) -> Branch
pub fn create_with_remote( conn: &OperationsConnection, branch_name: &str, remote_name: Option<&str>, ) -> SQLResult<Branch>
pub fn delete( conn: &OperationsConnection, branch_id: i64, ) -> Result<(), BranchError>
pub fn all(conn: &OperationsConnection) -> Vec<Branch>
pub fn get_by_name( conn: &OperationsConnection, branch_name: &str, ) -> Option<Branch>
pub fn get_by_id(conn: &OperationsConnection, branch_id: i64) -> Option<Branch>
pub fn set_current_operation( conn: &OperationsConnection, branch_id: i64, operation_hash: &HashId, )
pub fn get_operations( conn: &OperationsConnection, branch_id: i64, ) -> Vec<Operation>
Sourcepub fn set_remote(
conn: &OperationsConnection,
branch_id: i64,
remote_name: Option<&str>,
) -> SQLResult<()>
pub fn set_remote( conn: &OperationsConnection, branch_id: i64, remote_name: Option<&str>, ) -> SQLResult<()>
Associate a branch with a remote
Sourcepub fn set_remote_validated(
conn: &OperationsConnection,
branch_id: i64,
remote_name: Option<&str>,
) -> Result<(), RemoteError>
pub fn set_remote_validated( conn: &OperationsConnection, branch_id: i64, remote_name: Option<&str>, ) -> Result<(), RemoteError>
Associate a branch with a remote with validation
Sourcepub fn get_remote(conn: &OperationsConnection, branch_id: i64) -> Option<String>
pub fn get_remote(conn: &OperationsConnection, branch_id: i64) -> Option<String>
Get the remote associated with a branch
Trait Implementations§
Source§impl Query for Branch
impl Query for Branch
const TABLE_NAME: &'static str = "branches"
type Model = Branch
fn process_row(row: &Row<'_>) -> Self::Model
const PRIMARY_KEY: &'static str = "id"
fn query( conn: &Connection, query: &str, params: impl Params, ) -> Vec<Self::Model>
fn get( conn: &Connection, query: &str, params: impl Params, ) -> Result<Self::Model>
fn get_by_id<'a, T>(conn: &Connection, id: &'a T) -> Option<Self::Model>
fn query_by_ids<'a, I: ?Sized, T>( conn: &Connection, ids: &'a I, ) -> Vec<Self::Model>
fn delete_by_ids<'a, I: ?Sized, T>( conn: &Connection, ids: &'a I, ) -> Vec<Self::Model>
fn table_name() -> &'static str
fn all(conn: &Connection) -> Vec<Self::Model>
fn all_with_limit(conn: &Connection, limit: usize) -> Vec<Self::Model>
Auto Trait Implementations§
impl Freeze for Branch
impl RefUnwindSafe for Branch
impl Send for Branch
impl Sync for Branch
impl Unpin for Branch
impl UnsafeUnpin for Branch
impl UnwindSafe for Branch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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