Expand description
Records in SQLite, as an ObjectSpace.
use std::rc::Rc;
use ravenrs_app::{EntityInfo, FieldInfo, FieldKind, ObjectSpace, Query, Value};
use ravenrs_app_sqlite::{SqliteDatabase, TableMap};
let account = EntityInfo::new("Account")
.field(FieldInfo::new("id", FieldKind::Integer).key())
.field(FieldInfo::new("name", FieldKind::Text));
let connection = Rc::new(rusqlite::Connection::open_in_memory()?);
let database = SqliteDatabase::builder(connection).managed(account, TableMap::new("accounts"))?.build();
let mut space = database.space();
let mut object = space.new_object("Account")?;
object.set("name", "Corrente");
space.save(object)?;
space.commit()?;
let found = database.space().query("Account", &Query::all())?;
assert_eq!(found[0].get("name"), Value::Text("Corrente".into()));Structs§
- SqlWords
- What to say when the database refuses something, where
{0}is the field’s caption. - Sqlite
Attachment Store - Keeps the content of attached files in the database, in a table apart from the records.
- Sqlite
Builder - Puts a database together, one entity at a time.
- Sqlite
Database - Records in SQLite, on a connection that can be shared with the rest of an application. Any number of spaces share it.
- Sqlite
Model Store - Keeps a layer of the model in the database, under a name, as for one person’s settings.
- Sqlite
Object Space - A unit of work over a
SqliteDatabase. A commit is one transaction. - Table
Map - How an entity lands on a table.
Functions§
- entities_
from_ schema - Entities from the tables a database already has, for an application over a database that came first: a field per column, a reference per foreign key, and a required field per column that asks for it. A table with no single key is left out, since a record could not be found. What comes out is a start: captions and rules are for the application to give.