block-sequence
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "block-sequence", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A sequential id generator, which grabs blocks of ids rather than just one at a time", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,8 +7,16 @@ # block-sequence | ||
var BlockArray = require('block-sequence').BlockArray | ||
var bsr = require('block-sequence-redis') | ||
bsr({ host: 'redis.example.com' }, function(err, driver) { | ||
var init = require('block-sequence-mysql') | ||
// Initialise the MySql Block Sequence Driver. Other drivers are available | ||
init({ host: '127.0.0.1', database: 'bs_test', user: 'root' }, function(err, driver) { | ||
if (err) throw err | ||
// Ensure the sequence exists | ||
driver.ensure({ name: 'my-sequence' }, function(err, sequence) { | ||
if (err) throw err | ||
// Create a block array containing 1000 ids per block (defaults to 2 blocks) | ||
var idGenerator = new BlockArray({ block: { driver: driver, size: 1000 } }) | ||
// Grab the next id | ||
idGenerator.next(function(err, id) { | ||
@@ -48,4 +56,7 @@ if (err) throw err | ||
1. block-sequence-reference (in-memory reference implementation, only useful for testing) | ||
2. block-sequence-redis (redis implementation) | ||
1. [block-sequence-reference](https://www.npmjs.com/package/block-sequence-reference) (in-memory reference implementation, only useful for testing) | ||
2. [block-sequence-redis](https://www.npmjs.com/package/block-sequence-redis) | ||
3. [block-sequence-mysql](https://www.npmjs.com/package/block-sequence-mysql) | ||
4. [block-sequence-postgres](https://www.npmjs.com/package/block-sequence-postgres) | ||
5. [block-sequence-foxpro](https://www.youtube.com/watch?v=dQw4w9WgXcQ) | ||
@@ -52,0 +63,0 @@ To add another driver please ensure it passes the block-sequence-compliance-tests |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16497
103