Peacherine
The cross-platform and multi-datasource query module
Want to see support for another data source type? Open an issue so that it can be prioritized and tracked
Future development: continue to add popular database management systems (SQL, NoSQL, whatever...)
Why?
I think you should be able to query all mainstream data sources from any machine, and this module is the abstraction for that functionality to be consumed by CLI or GUI tools
Install
$ npm install peacherine
Supported data sources
Get supported data sources
const peacherine = ; const supportedDataSources = peacherine;// returns a string array of data source types
SQL Server and SQL Azure
Run query (SQL)
const peacherine = ; const connectionOptions = dataSourceType = 'mssql' server: '...' database: '...' username: '...' password: '...'; const actionOptions = query: 'SELECT object_id, name FROM sys.objects'; peacherine;
Test connection (SQL)
const peacherine = ; const connectionOptions = dataSourceType = 'mssql' server: '...' database: '...' username: '...' password: '...'; peacherine;
Azure DocumentDB
Query collection (DocumentDB)
const peacherine = ; const connectionOptions = dataSourceType: 'documentdb' endpoint: 'https://...documents.azure.com:.../' key: '...' database: '...'; const actionOptions = operation: 'queryCollection' query: 'SELECT * FROM c' collection: 'collection-name'; peacherine;
Insert document (DocumentDB)
const peacherine = ; const connectionOptions = dataSourceType: 'documentdb' endpoint: 'https://...documents.azure.com:.../' key: '...' database: '...'; const actionOptions = operation: 'createDocument' collection: 'collection-name' document: id: 'some-id' message: 'test document creation' ; peacherine;
Test connection (DocumentDB)
const peacherine = ; const connectionOptions = dataSourceType: 'documentdb' endpoint: 'https://...documents.azure.com:.../' key: '...' database: '...'; peacherine;
MongoDB
Query all documents (MongoDB)
const peacherine = ; const connectionOptions = dataSourceType: 'mongodb' host: '...' port: 27017 database: '...'; const actionOptions = operation: 'queryCollection' collection: 'collection-name'; peacherine;
Query documents in collection with filter (MongoDB)
const peacherine = ; const connectionOptions = dataSourceType: 'mongodb' host: '...' port: 27017 database: '...'; const actionOptions = operation: 'queryCollection' collection: 'collection-name' filter: id: 1 ; peacherine;
Insert document (MongoDB)
const peacherine = ; const connectionOptions = dataSourceType: 'mongodb' host: '...' port: 27017 database: '...'; const actionOptions = operation: 'createDocument' collection: 'collection-name' document: id: 1 message: 'test document creation' ; peacherine;
Update document (MongoDB)
const peacherine = ; const connectionOptions = dataSourceType: 'mongodb' host: '...' port: 27017 database: '...'; const actionOptions = operation: 'updateDocuments' collection: 'collection-name' filter: id: 1 updateOptions: $set: message: 'my new message' ; peacherine;
Delete document (MongoDB)
const peacherine = ; const connectionOptions = dataSourceType: 'mongodb' host: '...' port: 27017 database: '...'; actionOptions = operation: 'deleteDocuments' collection: 'collection-name' filter: id: 1 ; peacherine;
Test connection (MongoDB)
const peacherine = ; const connectionOptions = dataSourceType: 'mongodb' host: '...' port: 27017 database: '...'; peacherine;
MySQL
Run query (MySQL)
const peacherine = ; const connectionOptions = dataSourceType: 'mysql' server: '...' database: '...' username: '...' password: '...'; const actionOptions = query: 'SELECT * FROM information_schema.tables'; peacherine;
Test connection (MySQL)
const peacherine = ; const connectionOptions = dataSourceType: 'mysql' server: '...' database: '...' username: '...' password: '...'; peacherine;
Test
Want to contribute? Clone the repo and use npm test
to run unit tests
$ git clone https://github.com/tstringer/peacherine.git
$ cd peacherine
$ npm install
$ npm test