#sqlite #rusqlite #container #vec #wrapper

sqlvec

A generic container for vectors allowing for rusqlite operations

2 releases

0.0.2 Mar 2, 2024
0.0.1 Feb 15, 2024

#1626 in Database interfaces

Download history 25/week @ 2024-09-23 24/week @ 2024-09-30

58 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
~425K SLoC