Skip to main content

FakeNeon

Struct FakeNeon 

Source
pub struct FakeNeon { /* private fields */ }
Available on crate feature neon only.
Expand description

One Neon project in memory, behaving as the spike found the real one does (docs/neon.md): a new branch copies its parent’s functions, buckets and credentials at creation, a reset leaves functions alone, and annotations are kept. Every change is recorded (calls).

Implementations§

Source§

impl FakeNeon

Source

pub fn new(project: &str) -> Self

The project project with one default branch, main (database neondb, storage enabled), signed in.

Source

pub fn from_fixtures(project: &str, dir: &Path) -> Result<Self, String>

The project as the spike captured it in dir (tests/fixtures/neon/<version>/): its branches with their annotations (api-branches.json, branches-list.json) and the functions on the default branch (functions-list.json).

Source

pub fn deploy_function(&self, name_or_id: &str, slug: &str)

Deploy the function slug on the branch name_or_id.

Source

pub fn set_signed_in(&self, signed_in: bool)

Sign the CLI out (or back in).

Source

pub fn calls(&self) -> Vec<NeonCall>

Every change asked of it, in order.

Source

pub fn credentials(&self, name_or_id: &str) -> Vec<String>

The credentials on the branch name_or_id, by token id.

Trait Implementations§

Source§

impl Clone for FakeNeon

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl NeonControl for FakeNeon

Source§

fn auth_status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Who the CLI is signed in as (an error when it isn’t).
Source§

fn branches<'life0, 'life1, 'async_trait>( &'life0 self, project: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Branch>, NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The project’s branches, with their annotations.
Source§

fn create_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, project: &'life1 str, spec: &'life2 CreateBranch, ) -> Pin<Box<dyn Future<Output = Result<Branch, NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a branch (never printing its credentials).
Source§

fn delete_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, project: &'life1 str, id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete the branch id.
Source§

fn reset_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, project: &'life1 str, id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Reset the branch id to its parent’s current state.
Source§

fn connection<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, project: &'life1 str, branch: &'life2 str, database: Option<&'life3 str>, pooled: bool, ) -> Pin<Box<dyn Future<Output = Result<Connection, NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

The branch’s Postgres connection to database (the default one when None), through the connection pooler when pooled.
Source§

fn databases<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, project: &'life1 str, branch: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The branch’s databases.
Source§

fn create_database<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, project: &'life1 str, branch: &'life2 str, name: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Create the database name on the branch.
Source§

fn functions<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, project: &'life1 str, branch: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Function>, NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The functions deployed on the branch.
Source§

fn storage<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, project: &'life1 str, branch: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Storage, NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The branch’s object storage.
Source§

fn buckets<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, project: &'life1 str, branch: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The branch’s buckets.
Source§

fn create_bucket<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, project: &'life1 str, branch: &'life2 str, name: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Create the bucket name on the branch.
Source§

fn create_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, project: &'life1 str, branch: &'life2 str, name: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<StorageCredential, NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Mint a storage credential (read and write) called name on the branch.
Source§

fn revoke_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, project: &'life1 str, branch: &'life2 str, token_id: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), NeonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Revoke the credential token_id on the branch.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.