pub struct Glue {
    pub primary: String,
    /* private fields */
}
Expand description

Glue

Glue is the interface for interacting with MultiSQL; a Glue instance comprises any number of stores, each with their own identifier. Once built, one will typically interact with Glue via queries.

There is a number of ways to deposit queries however, depending on the desired output:

Fields

primary: String

Implementations

Only for SELECT queries.

Output is one big String of JSON, wrapped in a Result in case it fails.

Generally useful for webby interactions.

Only for SELECT queries.

Output is one big String of JSON, failures will be converted to json of {error: [error]}.

Generally useful for webby interactions.

Only for SELECT queries.

Only for SELECT queries.

Creates a Glue instance with just one Database.

Creates a Glue instance with access to all provided storages. Argument is: Vec<(Identifier, Database)>

Merges existing Glue instances

Merge existing Glue with Vec of other Glues For example:

use multisql::{SledDatabase, Database, Glue};
let storage = SledDatabase::new("data/example_location/example")
  .map(Database::new_sled)
  .expect("Database Creation Failed");
let mut glue = Glue::new(String::from("main"), storage);

glue.execute_many("
  DROP TABLE IF EXISTS test;
  CREATE TABLE test (id INTEGER);
  INSERT INTO test VALUES (1),(2);
  SELECT * FROM test WHERE id > 1;
");

let other_storage = SledDatabase::new("data/example_location/example_other")
  .map(Database::new_sled)
  .expect("Database Creation Failed");
let mut other_glue = Glue::new(String::from("other"), other_storage);

glue.extend_many_glues(vec![other_glue]);

Extend using a [Path] String which represents a path Guesses the type of database based on the extension Returns bool of whether action was taken

Extend Glue by single database Returns bool of whether action was taken

Opposite of Glue::extend, removes database Returns bool of whether action was taken

Will execute a single query.

Will execute a set of queries.

Will execute a pre-parsed query (see Glue::pre_parse() for more).

Provides a parsed query to execute later. Particularly useful if executing a small query many times as parsing is not (computationally) free.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.