Code Monkey home page Code Monkey logo

knex-case-converter-plugin's People

Contributors

dependabot[bot] avatar mkhanal avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

knex-case-converter-plugin's Issues

Plugin does not update the model attributes on save

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
}

Plugin doesn't seem to work with .raw()

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.