DBIx-NoSQL

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    DBIx::NoSQL - NoSQL-ish overlay for an SQL database

VERSION
    version 0.0020

SYNOPSIS
        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 and then inserted/updated via 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 and
    returned

    The API is fairly sane, though still beta



( run in 0.676 second using v1.01-cache-2.11-cpan-39bf76dae61 )