mkhanal / knex-case-converter-plugin Goto Github PK
View Code? Open in Web Editor NEWKnexjs - convert snake_case column names to camelCase on query and the reverse when using parameters
License: GNU General Public License v3.0
Knexjs - convert snake_case column names to camelCase on query and the reverse when using parameters
License: GNU General Public License v3.0
When a record will be saved then the save promise doesn't return anymore the model which contains the attributes from the database (id remains undefined...)
const response = await Role.forge({
title: '12',
active: 1,
}).save();
ModelBase {
attributes: [Object: null prototype] { title: '12', active: 1 },
_previousAttributes: {},
changed: [Object: null prototype] {},
relations: {},
cid: 'c1',
_knex: null,
id: undefined
}
Have you run into any issues where writing queries with knex.raw(...)
don't return converted rows?
Currently if I do a query like
database.raw(`
SELECT associate.*, market_id
FROM associate
JOIN store ON store.id = associate.store_id
JOIN market ON market.id = store.market_id
WHERE associate.active = true
AND market.id = ${marketId}
`);
the rows getting returned have fields like market_id
.
where when I run the query using knex methods like
database('associate')
.join('store', 'store.id', '=', 'associate.store_id')
.join('market', 'market.id', '=', 'store.market_id')
.where('associate.active', '=', active)
.andWhere('market.id', '=', marketId)
.select('associate.*', 'market_id');
the rows returned have camelcase fields like marketId
I am not sure if I am doing anything wrong, any insight would be appreciated.
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.