DBIx-NoSQL
view release on metacpan or search on metacpan
README.mkdn view on Meta::CPAN
# NAME
DBIx::NoSQL - NoSQL-ish overlay for an SQL database
# VERSION
version 0.0021
# SYNOPSIS
```perl
use DBIx::NoSQL;
my $store = DBIx::NoSQL->connect( 'store.sqlite' );
$store->set( 'Artist' => 'Smashing Pumpkins' => {
name => 'Smashing Pumpkins',
genre => 'rock',
website => 'smashingpumpkins.com',
} );
$store->exists( 'Artist' => 'Smashing Pumpkins' ); # 1
$store->set( 'Artist' => 'Tool' => {
name => 'Tool',
genre => 'rock',
} );
$store->search( 'Artist' )->count; # 2
my $artist = $store->get( 'Artist' => 'Smashing Pumpkins' );
# Set up a (searchable) index on the name field
$store->model( 'Artist' )->index( 'name' );
$store->model( 'Artist' )->reindex;
for $artist ( $store->search( 'Artist' )->order_by( 'name DESC' )->all ) {
...
}
$store->model( 'Album' )->index( 'released' => ( isa => 'DateTime' ) );
$store->set( 'Album' => 'Siamese Dream' => {
artist => 'Smashing Pumpkins',
released => DateTime->new( ... ),
} );
my $album = $store->get( 'Album' => 'Siamese Dream' );
my $released = $album->{ released }; # The field is automatically inflated
print $release->strftime( ... );
```
# DESCRIPTION
DBIx::NoSQL is a layer over DBI that presents a NoSQLish way to store and retrieve data. It does this by using a table called `__Store__`. Once connected to a database, it will detect if this table is missing and create it if necessary
When writing data to the store, the data (a HASH reference) is first serialized using [JSON](https://metacpan.org/pod/JSON) and then inserted/updated via [DBIx::Class](https://metacpan.org/pod/DBIx::Class) to (currently) an SQLite backend
Retrieving data from the store is done by key lookup or by searching an SQL-based index. Once found, the data is deserialized via [JSON](https://metacpan.org/pod/JSON) and returned
The API is fairly sane, though still beta
# USAGE
( run in 0.559 second using v1.01-cache-2.11-cpan-39bf76dae61 )