mirror of
https://github.com/knex/knex.git
synced 2025-11-02 02:40:13 +00:00
Added issue template and runkit example.
This commit is contained in:
parent
69cccdc89a
commit
4b9e44f8ef
40
.github/ISSUE_TEMPLATE.md
vendored
Normal file
40
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
# Environment
|
||||
|
||||
Knex version:
|
||||
Database + version:
|
||||
OS:
|
||||
|
||||
Select applicable tempalate from below.
|
||||
If issue is about oracledb support tag @ atiertant. For MSSql tag @ Grimace1975 .
|
||||
Rest of dialects doesn't need tags.
|
||||
|
||||
# Bug
|
||||
|
||||
1. Explain what kind of behaviour you are getting and how you think it should do
|
||||
|
||||
2. Error massage
|
||||
|
||||
3. Reduced test code, for example in https://npm.runkit.com/knex or if it needs real
|
||||
database connection to mysql or postgresql, then single file example which initializes
|
||||
needed data and demonstrates the problem.
|
||||
|
||||
|
||||
# Feature discussion / request
|
||||
|
||||
1. Explain what is your use case
|
||||
|
||||
2. Explain what kind of feature would support this
|
||||
|
||||
3. Give some API proposal, how the feature should work
|
||||
|
||||
|
||||
# Missing / erroneus documentation
|
||||
|
||||
Send issue to documentation repo, or fix it and send PR https://github.com/knex/documentation
|
||||
|
||||
|
||||
# Questions about how to use knex
|
||||
|
||||
Github issues are for knex development. Please send questions how to use knex to
|
||||
stackoverflow or ask about it in gitter chat.
|
||||
|
||||
@ -131,5 +131,6 @@
|
||||
"CHANGELOG.md",
|
||||
"scripts/*"
|
||||
],
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"tonicExampleFilename": "scripts/runkit-example.js"
|
||||
}
|
||||
|
||||
32
scripts/runkit-example.js
Normal file
32
scripts/runkit-example.js
Normal file
@ -0,0 +1,32 @@
|
||||
require('sqlite3');
|
||||
const Knex = require('knex');
|
||||
|
||||
const knexSqlite = Knex({
|
||||
client: 'sqlite',
|
||||
connection: ':memory:'
|
||||
});
|
||||
|
||||
const knexMysql = Knex({
|
||||
client: 'mysql2',
|
||||
});
|
||||
|
||||
const knexPg = Knex({
|
||||
client: 'pg'
|
||||
});
|
||||
|
||||
await knexSqlite.schema.createTable('test', t => {
|
||||
t.increments('id').primary();
|
||||
t.string('data');
|
||||
});
|
||||
|
||||
await knexSqlite('test').insert([{ data: 'foo' }, { data: 'bar' }]);
|
||||
|
||||
console.log('test table data:', await knexSqlite('test'));
|
||||
|
||||
console.log(
|
||||
knexPg({ f: 'foo', b: 'bar' })
|
||||
.select('foo.*')
|
||||
.where('f.name', knexPg.raw('??', ['b.name']))
|
||||
.whereIn('something', knexPg('bar').select('id'))
|
||||
.toSQL().sql
|
||||
);
|
||||
Loading…
x
Reference in New Issue
Block a user