mirror of
https://github.com/fluencelabs/examples
synced 2025-04-25 10:42:16 +00:00
update to marine, marine-test, bump versions
This commit is contained in:
parent
e17fab988e
commit
9ba8c49898
@ -10,5 +10,6 @@ name = "sqlite_test"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fluence = "0.5.0"
|
fluence = "0.6.9"
|
||||||
fce-sqlite-connector = "0.2.0"
|
marine-sqlite-connector = "0.4.1"
|
||||||
|
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
set -o errexit -o nounset -o pipefail
|
set -o errexit -o nounset -o pipefail
|
||||||
|
|
||||||
# This script builds all subprojects and puts all created Wasm modules in one dir
|
# This script builds all subprojects and puts all created Wasm modules in one dir
|
||||||
cargo update
|
cargo update --aggressive
|
||||||
fce build --release
|
marine build --release
|
||||||
|
|
||||||
rm artifacts/*
|
mkdir -p artifacts
|
||||||
cp ../../target/wasm32-wasi/release/sqlite_test.wasm artifacts/
|
rm -f artifacts/*.wasm
|
||||||
wget https://github.com/fluencelabs/sqlite/releases/download/v0.10.0_w/sqlite3.wasm
|
cp target/wasm32-wasi/release/sqlite_test.wasm artifacts/
|
||||||
|
wget https://github.com/fluencelabs/sqlite/releases/download/v0.14.0_w/sqlite3.wasm
|
||||||
mv sqlite3.wasm artifacts/
|
mv sqlite3.wasm artifacts/
|
||||||
|
@ -14,19 +14,19 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use fluence::fce;
|
use fluence::marine;
|
||||||
use fluence::module_manifest;
|
use fluence::module_manifest;
|
||||||
|
|
||||||
use fce_sqlite_connector;
|
use marine_sqlite_connector;
|
||||||
use fce_sqlite_connector::State;
|
use marine_sqlite_connector::State;
|
||||||
|
|
||||||
module_manifest!();
|
module_manifest!();
|
||||||
|
|
||||||
pub fn main() {}
|
pub fn main() {}
|
||||||
|
|
||||||
#[fce]
|
#[marine]
|
||||||
pub fn test1(age: i64) {
|
pub fn test1(age: i64) {
|
||||||
let connection = fce_sqlite_connector::open(":memory:").unwrap();
|
let connection = marine_sqlite_connector::open(":memory:").unwrap();
|
||||||
|
|
||||||
connection
|
connection
|
||||||
.execute(
|
.execute(
|
||||||
@ -50,11 +50,11 @@ pub fn test1(age: i64) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[fce]
|
#[marine]
|
||||||
pub fn test2(age: i64) {
|
pub fn test2(age: i64) {
|
||||||
use fce_sqlite_connector::Value;
|
use marine_sqlite_connector::Value;
|
||||||
|
|
||||||
let connection = fce_sqlite_connector::open(":memory:").unwrap();
|
let connection = marine_sqlite_connector::open(":memory:").unwrap();
|
||||||
|
|
||||||
connection
|
connection
|
||||||
.execute(
|
.execute(
|
||||||
@ -85,10 +85,10 @@ pub fn test2(age: i64) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[fce]
|
#[marine]
|
||||||
pub fn test3() {
|
pub fn test3() {
|
||||||
let db_path = "/tmp/users.sqlite";
|
let db_path = "/tmp/users.sqlite";
|
||||||
let connection = fce_sqlite_connector::open(db_path).expect("db should be opened");
|
let connection = marine_sqlite_connector::open(db_path).expect("db should be opened");
|
||||||
|
|
||||||
connection
|
connection
|
||||||
.execute(
|
.execute(
|
||||||
@ -100,7 +100,7 @@ pub fn test3() {
|
|||||||
)
|
)
|
||||||
.expect("table should be created successfully");
|
.expect("table should be created successfully");
|
||||||
|
|
||||||
let connection = fce_sqlite_connector::open(db_path).expect("db should be opened");
|
let connection = marine_sqlite_connector::open(db_path).expect("db should be opened");
|
||||||
let cursor = connection.prepare("SELECT * FROM users").unwrap().cursor();
|
let cursor = connection.prepare("SELECT * FROM users").unwrap().cursor();
|
||||||
|
|
||||||
println!("table size is: {:?}", cursor.count());
|
println!("table size is: {:?}", cursor.count());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user