#sqlite #rusqlite #container #wrapper #vec

sqlvec

A generic container for vectors allowing for rusqlite operations

2 releases

0.0.2 Mar 2, 2024
0.0.1 Feb 15, 2024

#877 in Database interfaces

Download history 73/week @ 2024-02-12 18/week @ 2024-02-19 170/week @ 2024-02-26 34/week @ 2024-03-04 6/week @ 2024-03-11 105/week @ 2024-03-25 24/week @ 2024-04-01

138 downloads per month

GPL-3.0 license

16KB
72 lines

SqlVec

A generic container for vectors allowing for rusqlite operations.

The vector must contain elements that implement ToString & FromStr.

SqlVec implements ToSql & FromSql storing values as \u{F1} delimited text.

If the sqlite conversion is to be bidirectional then the ToString & FromStr must also be bidirectional.

[dependencies]
sqlvec = { version = "0.0.1", features = ["serde"] }

Usage

Wrap a vector with SqlVec before passing to the database.

use sqlvec::SqlVec;

let values = SqlVec::new(vec!["one".to_string(), "two".to_string()]);
connection.execute(
    "INSERT INTO test (data) VALUES (?1)",
    params![values],
).unwrap();

Dependencies

~22MB
~409K SLoC