New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

js-data-sql

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-data-sql - npm Package Compare versions

Comparing version 1.0.0-beta.3 to 1.0.0

CONTRIBUTORS

4

CHANGELOG.md

@@ -0,1 +1,5 @@

##### 1.0.0 - 17 August 2017
Stable 1.0.0 release
##### 1.0.0-beta.3 - 16 May 2016

@@ -2,0 +6,0 @@

193

dist/js-data-sql.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var knex = _interopDefault(require('knex'));
var Promise = _interopDefault(require('bluebird'));
var jsData = require('js-data');
var jsDataAdapter = require('js-data-adapter');
var toString = _interopDefault(require('mout/lang/toString'));
var underscore = _interopDefault(require('mout/string/underscore'));
var toString = _interopDefault(require('lodash.tostring'));
var snakeCase = _interopDefault(require('lodash.snakecase'));
var babelHelpers = {};
babelHelpers.slicedToArray = function () {
var slicedToArray = function () {
function sliceIterator(arr, i) {

@@ -52,6 +51,2 @@ var _arr = [];

babelHelpers;
jsData.utils.Promise = Promise;
var DEFAULTS = {};

@@ -149,24 +144,22 @@

} else if (KILOMETERS_REGEXP.test(value.radius)) {
radius = value.radius.match(KILOMETERS_REGEXP)[1];
unitsPerDegree = 111.045; // kilometers per degree;
} else {
throw new Error('Unknown radius distance units');
}
radius = value.radius.match(KILOMETERS_REGEXP)[1];
unitsPerDegree = 111.045; // kilometers per degree;
} else {
throw new Error('Unknown radius distance units');
}
var _field$split$map = field.split(',').map(function (c) {
return c.trim();
});
}),
_field$split$map2 = slicedToArray(_field$split$map, 2),
latitudeColumn = _field$split$map2[0],
longitudeColumn = _field$split$map2[1];
var _field$split$map2 = babelHelpers.slicedToArray(_field$split$map, 2);
var _value$center = slicedToArray(value.center, 2),
latitude = _value$center[0],
longitude = _value$center[1];
var latitudeColumn = _field$split$map2[0];
var longitudeColumn = _field$split$map2[1];
// Uses indexes on `latitudeColumn` / `longitudeColumn` if available
var _value$center = babelHelpers.slicedToArray(value.center, 2);
var latitude = _value$center[0];
var longitude = _value$center[1];
// Uses indexes on `latitudeColumn` / `longitudeColumn` if available
query = query.whereBetween(latitudeColumn, [latitude - radius / unitsPerDegree, latitude + radius / unitsPerDegree]).whereBetween(longitudeColumn, [longitude - radius / (unitsPerDegree * Math.cos(latitude * (Math.PI / 180))), longitude + radius / (unitsPerDegree * Math.cos(latitude * (Math.PI / 180)))]);

@@ -189,16 +182,16 @@

* // Use Container instead of DataStore on the server
* import {Container} from 'js-data'
* import SqlAdapter from 'js-data-sql'
* import { Container } from 'js-data';
* import SqlAdapter from 'js-data-sql';
*
* // Create a store to hold your Mappers
* const store = new Container()
* const store = new Container();
*
* // Create an instance of SqlAdapter with default settings
* const adapter = new SqlAdapter()
* const adapter = new SqlAdapter();
*
* // Mappers in "store" will use the Sql adapter by default
* store.registerAdapter('sql', adapter, { default: true })
* store.registerAdapter('sql', adapter, { default: true });
*
* // Create a Mapper that maps to a "user" table
* store.defineMapper('user')
* store.defineMapper('user');
*

@@ -246,17 +239,6 @@ * @class SqlAdapter

// Setup prototype inheritance from Adapter
SqlAdapter.prototype = Object.create(jsDataAdapter.Adapter.prototype, {
constructor: {
value: SqlAdapter,
enumerable: false,
writable: true,
configurable: true
}
});
function getTable(mapper) {
return mapper.table || snakeCase(mapper.name);
}
Object.defineProperty(SqlAdapter, '__super__', {
configurable: true,
value: jsDataAdapter.Adapter
});
/**

@@ -266,11 +248,11 @@ * Alternative to ES2015 class syntax for extending `SqlAdapter`.

* @example <caption>Using the ES2015 class syntax.</caption>
* class MySqlAdapter extends SqlAdapter {...}
* const adapter = new MySqlAdapter()
* class MySqlAdapter extends SqlAdapter {...};
* const adapter = new MySqlAdapter();
*
* @example <caption>Using {@link SqlAdapter.extend}.</caption>
* var instanceProps = {...}
* var classProps = {...}
* const instanceProps = {...};
* const classProps = {...};
*
* var MySqlAdapter = SqlAdapter.extend(instanceProps, classProps)
* var adapter = new MySqlAdapter()
* const MySqlAdapter = SqlAdapter.extend(instanceProps, classProps);
* const adapter = new MySqlAdapter();
*

@@ -287,6 +269,2 @@ * @method SqlAdapter.extend

function getTable(mapper) {
return mapper.table || underscore(mapper.name);
}
/*

@@ -486,3 +464,5 @@ function processRelationField (resourceConfig, query, field, criteria, options, joinedTables) {

jsData.utils.addHiddenPropsToTarget(SqlAdapter.prototype, {
jsDataAdapter.Adapter.extend({
constructor: SqlAdapter,
_count: function _count(mapper, query, opts) {

@@ -775,3 +755,3 @@ opts || (opts = {});

getTable: function getTable(mapper) {
return mapper.table || underscore(mapper.name);
return mapper.table || snakeCase(mapper.name);
},

@@ -789,4 +769,8 @@ selectTable: function selectTable(mapper, opts) {

*
* @example
* import { version } from 'js-data-sql';
* console.log(version.full);
*
* @name module:js-data-sql.version
* @type {Object}
* @type {object}
* @property {string} version.full The full semver value.

@@ -802,4 +786,3 @@ * @property {number} version.major The major version number.

var version = {
beta: 3,
full: '1.0.0-beta.3',
full: '1.0.0',
major: 1,

@@ -811,12 +794,27 @@ minor: 0,

/**
* {@link SqlAdapter} class.
*
* @example
* import { SqlAdapter } from 'js-data-sql';
* const adapter = new SqlAdapter();
*
* @name module:js-data-sql.SqlAdapter
* @see SqlAdapter
* @type {Constructor}
*/
/**
* Registered as `js-data-sql` in NPM.
*
* @example <caption>CommonJS</caption>
* var SqlAdapter = require('js-data-sql').SqlAdapter
* var adapter = new SqlAdapter()
* @example <caption>Install from NPM (for use with MySQL)</caption>
* npm i --save js-data-sql js-data mysql
*
* @example <caption>ES2015 Modules</caption>
* import {SqlAdapter} from 'js-data-sql'
* const adapter = new SqlAdapter()
* @example <caption>Load via CommonJS</caption>
* const SqlAdapter = require('js-data-sql').SqlAdapter;
* const adapter = new SqlAdapter();
*
* @example <caption>Load via ES2015 Modules</caption>
* import { SqlAdapter } from 'js-data-sql';
* const adapter = new SqlAdapter();
*
* @module js-data-sql

@@ -829,8 +827,8 @@ */

* @example <caption>CommonJS</caption>
* var SqlAdapter = require('js-data-sql').SqlAdapter
* var adapter = new SqlAdapter()
* const SqlAdapter = require('js-data-sql').SqlAdapter;
* const adapter = new SqlAdapter();
*
* @example <caption>ES2015 Modules</caption>
* import {SqlAdapter} from 'js-data-sql'
* const adapter = new SqlAdapter()
* import { SqlAdapter } from 'js-data-sql';
* const adapter = new SqlAdapter();
*

@@ -841,5 +839,58 @@ * @name module:js-data-sql.SqlAdapter

/**
* Create a subclass of this SqlAdapter:
* @example <caption>SqlAdapter.extend</caption>
* // Normally you would do: import { SqlAdapter } from 'js-data-sql';
* const JSDataSql = require('js-data-sql');
* const { SqlAdapter } = JSDataSql;
* console.log('Using JSDataSql v' + JSDataSql.version.full);
*
* // Extend the class using ES2015 class syntax.
* class CustomSqlAdapterClass extends SqlAdapter {
* foo () { return 'bar'; }
* static beep () { return 'boop'; }
* }
* const customSqlAdapter = new CustomSqlAdapterClass();
* console.log(customSqlAdapter.foo());
* console.log(CustomSqlAdapterClass.beep());
*
* // Extend the class using alternate method.
* const OtherSqlAdapterClass = SqlAdapter.extend({
* foo () { return 'bar'; }
* }, {
* beep () { return 'boop'; }
* });
* const otherSqlAdapter = new OtherSqlAdapterClass();
* console.log(otherSqlAdapter.foo());
* console.log(OtherSqlAdapterClass.beep());
*
* // Extend the class, providing a custom constructor.
* function AnotherSqlAdapterClass () {
* SqlAdapter.call(this);
* this.created_at = new Date().getTime();
* }
* SqlAdapter.extend({
* constructor: AnotherSqlAdapterClass,
* foo () { return 'bar'; }
* }, {
* beep () { return 'boop'; }
* });
* const anotherSqlAdapter = new AnotherSqlAdapterClass();
* console.log(anotherSqlAdapter.created_at);
* console.log(anotherSqlAdapter.foo());
* console.log(AnotherSqlAdapterClass.beep());
*
* @method SqlAdapter.extend
* @param {object} [props={}] Properties to add to the prototype of the
* subclass.
* @param {object} [props.constructor] Provide a custom constructor function
* to be used as the subclass itself.
* @param {object} [classProps={}] Static properties to add to the subclass.
* @returns {Constructor} Subclass of this SqlAdapter class.
* @since 3.0.0
*/
exports.OPERATORS = OPERATORS;
exports.SqlAdapter = SqlAdapter;
exports.version = version;
//# sourceMappingURL=js-data-sql.js.map
//# sourceMappingURL=js-data-sql.js.map
{
"name": "js-data-sql",
"description": "Postgres/MySQL/MariaDB/SQLite3 adapter for js-data.",
"version": "1.0.0-beta.3",
"version": "1.0.0",
"homepage": "https://github.com/js-data/js-data-sql",

@@ -45,25 +45,17 @@ "repository": {

"ignore": [
"dist/",
"test/"
"dist/"
]
},
"babel": {
"presets": [
"es2015-rollup"
]
},
"scripts": {
"lint": "repo-tools lint \"**/*.js\"",
"bundle": "rollup -c rollup.config.js -f cjs -o dist/js-data-sql.js -m dist/js-data-sql.js.map src/index.js && repo-tools write-version dist/js-data-sql.js",
"lint": "standard '**/*.js'",
"bundle": "rollup src/index.js -c -o dist/js-data-sql.js -m dist/js-data-sql.js.map -f cjs && repo-tools write-version dist/js-data-sql.js",
"doc": "jsdoc -c conf.json src node_modules/js-data-adapter/src",
"watch": "watch \"npm run bundle\" src/",
"build": "npm run lint && npm run bundle",
"mocha-sqlite3": "DB_CLIENT=sqlite3 DB_FILE=\"./test.db\" mocha -t 30000 -R dot -r source-map-support/register mocha.start.js",
"mocha-mysql": "DB_CLIENT=mysql DB_USER=root mocha -t 30000 -R dot -r source-map-support/register mocha.start.js",
"mocha-pg": "DB_CLIENT=pg mocha -t 30000 -R dot -r source-map-support/register mocha.start.js",
"mocha-mysql": "DB_CLIENT=mysql mocha -t 30000 -R dot -r babel-core/register -r babel-polyfill mocha.start.js",
"mocha-pg": "DB_CLIENT=pg mocha -t 30000 -R dot -r babel-core/register -r babel-polyfill mocha.start.js",
"mocha-all": "npm run mocha-mysql && npm run mocha-pg",
"cover": "DB_CLIENT=mysql DB_USER=root istanbul cover --hook-run-in-context node_modules/mocha/bin/_mocha -- -t 30000 -R dot -r source-map-support/register mocha.start.js",
"test": "npm run lint && npm run build && npm run cover",
"release": "npm test && npm run doc && repo-tools updates && repo-tools changelog && repo-tools authors",
"ci": "npm run test && cat coverage/lcov.info | codecov",
"cover": "nyc --require babel-core/register --require babel-polyfill --cache mocha -t 20000 -R dot mocha.start.js && nyc report --reporter=html",
"test": "npm run build && npm run cover",
"release": "npm test && npm run doc && repo-tools changelog && repo-tools authors",
"create-migration": "knex --cwd=test migrate:make",

@@ -74,20 +66,32 @@ "migrate-db": "knex --cwd=test migrate:latest",

"dependencies": {
"js-data-adapter": "~0.6.2",
"mout": "1.0.0"
"js-data": ">=3.0.0",
"js-data-adapter": "1.0.0",
"knex": ">=0.13.0",
"lodash.snakecase": "4.1.1",
"lodash.tostring": "4.1.4",
"mysql": "^2.14.1"
},
"peerDependencies": {
"js-data": "^3.0.0-beta.5",
"knex": ">=0.7.4"
"js-data": ">=3.0.0",
"knex": ">=0.13.0"
},
"devDependencies": {
"babel-polyfill": "6.8.0",
"babel-preset-es2015-rollup": "1.1.1",
"istanbul": "0.4.3",
"js-data-adapter-tests": "^2.0.0-alpha.20",
"js-data-repo-tools": "0.5.1",
"rollup": "0.26.3",
"rollup-plugin-babel": "2.4.0",
"source-map-support": "0.4.0",
"watch": "0.18.0"
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-plugin-external-helpers": "6.22.0",
"babel-plugin-syntax-async-functions": "6.13.0",
"babel-plugin-transform-regenerator": "6.26.0",
"babel-polyfill": "6.26.0",
"babel-preset-es2015": "6.24.1",
"chai": "4.1.1",
"ink-docstrap": "git+https://github.com/js-data/docstrap.git#cfbe45fa313e1628c493076d5e15d2b855dfbf2c",
"js-data-repo-tools": "1.0.0",
"jsdoc": "3.5.4",
"mocha": "3.5.0",
"nyc": "11.1.0",
"rollup": "0.47.6",
"rollup-plugin-babel": "3.0.2",
"sinon": "3.2.1",
"standard": "10.0.3"
}
}

@@ -5,41 +5,84 @@ <img src="https://raw.githubusercontent.com/js-data/js-data/master/js-data.png" alt="js-data logo" title="js-data" align="right" width="96" height="96" />

[![Slack Status][sl_b]][sl_l]
[![npm version][npm_b]][npm_l]
[![Circle CI][circle_b]][circle_l]
[![npm downloads][dn_b]][dn_l]
[![Coverage Status][cov_b]][cov_l]
[![Slack][1]][2]
[![NPM][3]][4]
[![Tests][5]][6]
[![Downloads][7]][8]
[![Coverage][9]][10]
Postgres/MySQL/MariaDB/SQLite3 adapter for [js-data](http://www.js-data.io/).
A Postgres/MySQL/MariaDB/SQLite3 adapter for the [JSData Node.js ORM][11].
To get started, visit __[http://js-data.io](http://www.js-data.io/docs/js-data-sql)__.
### Installation
## Links
npm install --save js-data js-data-sql
* [Quick start](http://www.js-data.io/docs/home#quick-start) - Get started in 5 minutes
* [Guides and Tutorials](http://www.js-data.io/docs/home) - Learn how to use JSData
* [`SqlAdapter` Guide](http://www.js-data.io/docs/js-data-sql) - Learn how to use `SqlAdapter`
* [API Reference Docs](http://api.js-data.io) - Explore components, methods, options, etc.
* [Community & Support](http://js-data.io/docs/community) - Find solutions and chat with the community
* [General Contributing Guide](http://js-data.io/docs/contributing) - Give back and move the project forward
* [Contributing to js-data-sql](https://github.com/js-data/js-data-sql/blob/master/.github/CONTRIBUTING.md)
And then you also need to install one of the following:
## License
* `pg`
* `sqlite3`
* `mysql`
* `mysql2`
* `mariasql`
* `strong-oracle`
* `oracle`
* `mssql`
The MIT License (MIT)
### Usage
Copyright (c) 2014-2016 js-data-sql project authors
```js
import { SqlAdapter } from 'js-data-sql';
* [LICENSE](https://github.com/js-data/js-data-sql/blob/master/LICENSE)
* [AUTHORS](https://github.com/js-data/js-data-sql/blob/master/AUTHORS)
* [CONTRIBUTORS](https://github.com/js-data/js-data-sql/blob/master/CONTRIBUTORS)
// Create an instance of SqlAdapter
const adapter = new SqlAdapter({
knexOpts: {
client: 'mysql'
}
});
[sl_b]: http://slack.js-data.io/badge.svg
[sl_l]: http://slack.js-data.io
[npm_b]: https://img.shields.io/npm/v/js-data-sql.svg?style=flat
[npm_l]: https://www.npmjs.org/package/js-data-sql
[circle_b]: https://img.shields.io/circleci/project/js-data/js-data-sql.svg?style=flat
[circle_l]: https://circleci.com/gh/js-data/js-data-sql
[dn_b]: https://img.shields.io/npm/dm/js-data-sql.svg?style=flat
[dn_l]: https://www.npmjs.org/package/js-data-sql
[cov_b]: https://img.shields.io/codecov/c/github/js-data/js-data-sql.svg?style=flat
[cov_l]: https://codecov.io/github/js-data/js-data-sql
// Other JSData setup hidden
// Register the adapter instance
store.registerAdapter('sql', adapter, { default: true });
```
### JSData + SQL Tutorial
Start with the [JSData + SQL tutorial][12] or checkout the [API Reference Documentation][13].
### Need help?
Please [post a question][14] on Stack Overflow. **This is the preferred method.**
You can also chat with folks on the [Slack Channel][15]. If you end up getting
your question answered, please still consider consider posting your question to
Stack Overflow (then possibly answering it yourself). Thanks!
### Want to contribute?
Awesome! You can get started over at the [Contributing guide][16].
Thank you!
### License
[The MIT License (MIT)][17]
Copyright (c) 2014-2017 [js-data-sql project authors][18]
[1]: http://slack.js-data.io/badge.svg
[2]: http://slack.js-data.io
[3]: https://img.shields.io/npm/v/js-data-sql.svg?style=flat
[4]: https://www.npmjs.org/package/js-data-sql
[5]: https://img.shields.io/circleci/project/js-data/js-data-sql.svg?style=flat
[6]: https://circleci.com/gh/js-data/js-data-sql
[7]: https://img.shields.io/npm/dm/js-data-sql.svg?style=flat
[8]: https://www.npmjs.org/package/js-data-sql
[9]: https://img.shields.io/codecov/c/github/js-data/js-data-sql.svg?style=flat
[10]: https://codecov.io/github/js-data/js-data-sql
[11]: http://www.js-data.io/
[12]: http://www.js-data.io/docs/js-data-sql
[13]: http://api.js-data.io/js-data-sql
[14]: http://stackoverflow.com/questions/tagged/jsdata
[15]: http://slack.js-data.io/
[16]: https://github.com/js-data/js-data-sql/blob/master/.github/CONTRIBUTING.md
[17]: https://github.com/js-data/js-data-sql/blob/master/LICENSE
[18]: https://github.com/js-data/js-data-sql/blob/master/AUTHORS
import knex from 'knex'
import Promise from 'bluebird'
import {utils} from 'js-data'
utils.Promise = Promise

@@ -10,4 +8,4 @@ import {

} from 'js-data-adapter'
import toString from 'mout/lang/toString'
import underscore from 'mout/string/underscore'
import toString from 'lodash.tostring'
import snakeCase from 'lodash.snakecase'

@@ -146,16 +144,16 @@ const DEFAULTS = {}

* // Use Container instead of DataStore on the server
* import {Container} from 'js-data'
* import SqlAdapter from 'js-data-sql'
* import { Container } from 'js-data';
* import SqlAdapter from 'js-data-sql';
*
* // Create a store to hold your Mappers
* const store = new Container()
* const store = new Container();
*
* // Create an instance of SqlAdapter with default settings
* const adapter = new SqlAdapter()
* const adapter = new SqlAdapter();
*
* // Mappers in "store" will use the Sql adapter by default
* store.registerAdapter('sql', adapter, { default: true })
* store.registerAdapter('sql', adapter, { default: true });
*
* // Create a Mapper that maps to a "user" table
* store.defineMapper('user')
* store.defineMapper('user');
*

@@ -203,17 +201,6 @@ * @class SqlAdapter

// Setup prototype inheritance from Adapter
SqlAdapter.prototype = Object.create(Adapter.prototype, {
constructor: {
value: SqlAdapter,
enumerable: false,
writable: true,
configurable: true
}
})
function getTable (mapper) {
return mapper.table || snakeCase(mapper.name)
}
Object.defineProperty(SqlAdapter, '__super__', {
configurable: true,
value: Adapter
})
/**

@@ -223,11 +210,11 @@ * Alternative to ES2015 class syntax for extending `SqlAdapter`.

* @example <caption>Using the ES2015 class syntax.</caption>
* class MySqlAdapter extends SqlAdapter {...}
* const adapter = new MySqlAdapter()
* class MySqlAdapter extends SqlAdapter {...};
* const adapter = new MySqlAdapter();
*
* @example <caption>Using {@link SqlAdapter.extend}.</caption>
* var instanceProps = {...}
* var classProps = {...}
* const instanceProps = {...};
* const classProps = {...};
*
* var MySqlAdapter = SqlAdapter.extend(instanceProps, classProps)
* var adapter = new MySqlAdapter()
* const MySqlAdapter = SqlAdapter.extend(instanceProps, classProps);
* const adapter = new MySqlAdapter();
*

@@ -244,6 +231,2 @@ * @method SqlAdapter.extend

function getTable (mapper) {
return mapper.table || underscore(mapper.name)
}
/*

@@ -443,3 +426,5 @@ function processRelationField (resourceConfig, query, field, criteria, options, joinedTables) {

utils.addHiddenPropsToTarget(SqlAdapter.prototype, {
Adapter.extend({
constructor: SqlAdapter,
_count (mapper, query, opts) {

@@ -724,3 +709,3 @@ opts || (opts = {})

getTable (mapper) {
return mapper.table || underscore(mapper.name)
return mapper.table || snakeCase(mapper.name)
},

@@ -739,4 +724,8 @@

*
* @example
* import { version } from 'js-data-sql';
* console.log(version.full);
*
* @name module:js-data-sql.version
* @type {Object}
* @type {object}
* @property {string} version.full The full semver value.

@@ -754,12 +743,27 @@ * @property {number} version.major The major version number.

/**
* {@link SqlAdapter} class.
*
* @example
* import { SqlAdapter } from 'js-data-sql';
* const adapter = new SqlAdapter();
*
* @name module:js-data-sql.SqlAdapter
* @see SqlAdapter
* @type {Constructor}
*/
/**
* Registered as `js-data-sql` in NPM.
*
* @example <caption>CommonJS</caption>
* var SqlAdapter = require('js-data-sql').SqlAdapter
* var adapter = new SqlAdapter()
* @example <caption>Install from NPM (for use with MySQL)</caption>
* npm i --save js-data-sql js-data mysql
*
* @example <caption>ES2015 Modules</caption>
* import {SqlAdapter} from 'js-data-sql'
* const adapter = new SqlAdapter()
* @example <caption>Load via CommonJS</caption>
* const SqlAdapter = require('js-data-sql').SqlAdapter;
* const adapter = new SqlAdapter();
*
* @example <caption>Load via ES2015 Modules</caption>
* import { SqlAdapter } from 'js-data-sql';
* const adapter = new SqlAdapter();
*
* @module js-data-sql

@@ -772,8 +776,8 @@ */

* @example <caption>CommonJS</caption>
* var SqlAdapter = require('js-data-sql').SqlAdapter
* var adapter = new SqlAdapter()
* const SqlAdapter = require('js-data-sql').SqlAdapter;
* const adapter = new SqlAdapter();
*
* @example <caption>ES2015 Modules</caption>
* import {SqlAdapter} from 'js-data-sql'
* const adapter = new SqlAdapter()
* import { SqlAdapter } from 'js-data-sql';
* const adapter = new SqlAdapter();
*

@@ -783,1 +787,54 @@ * @name module:js-data-sql.SqlAdapter

*/
/**
* Create a subclass of this SqlAdapter:
* @example <caption>SqlAdapter.extend</caption>
* // Normally you would do: import { SqlAdapter } from 'js-data-sql';
* const JSDataSql = require('js-data-sql');
* const { SqlAdapter } = JSDataSql;
* console.log('Using JSDataSql v' + JSDataSql.version.full);
*
* // Extend the class using ES2015 class syntax.
* class CustomSqlAdapterClass extends SqlAdapter {
* foo () { return 'bar'; }
* static beep () { return 'boop'; }
* }
* const customSqlAdapter = new CustomSqlAdapterClass();
* console.log(customSqlAdapter.foo());
* console.log(CustomSqlAdapterClass.beep());
*
* // Extend the class using alternate method.
* const OtherSqlAdapterClass = SqlAdapter.extend({
* foo () { return 'bar'; }
* }, {
* beep () { return 'boop'; }
* });
* const otherSqlAdapter = new OtherSqlAdapterClass();
* console.log(otherSqlAdapter.foo());
* console.log(OtherSqlAdapterClass.beep());
*
* // Extend the class, providing a custom constructor.
* function AnotherSqlAdapterClass () {
* SqlAdapter.call(this);
* this.created_at = new Date().getTime();
* }
* SqlAdapter.extend({
* constructor: AnotherSqlAdapterClass,
* foo () { return 'bar'; }
* }, {
* beep () { return 'boop'; }
* });
* const anotherSqlAdapter = new AnotherSqlAdapterClass();
* console.log(anotherSqlAdapter.created_at);
* console.log(anotherSqlAdapter.foo());
* console.log(AnotherSqlAdapterClass.beep());
*
* @method SqlAdapter.extend
* @param {object} [props={}] Properties to add to the prototype of the
* subclass.
* @param {object} [props.constructor] Provide a custom constructor function
* to be used as the subclass itself.
* @param {object} [classProps={}] Static properties to add to the subclass.
* @returns {Constructor} Subclass of this SqlAdapter class.
* @since 3.0.0
*/

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc