Coder Social home page Coder Social logo

tuple support about gesundheit HOT 5 CLOSED

betsmartmedia avatar betsmartmedia commented on July 28, 2024
tuple support

from gesundheit.

Comments (5)

grncdr avatar grncdr commented on July 28, 2024

Using the above commit you should be able to do the following:

var db = require('./my-app-database')
var tuple = require('gesundheit').tuple
var toField = require('gesundheit').toField

db.select('foo')
  .where(tuple(['bar','baz'].map(toField)).compare('IN', [[1, 2], [3, 4]])

The .map(toField) is necessary because tuple would otherwise convert 'bar'and 'baz' into parameters.

from gesundheit.

kamholz avatar kamholz commented on July 28, 2024

Thanks, this is quite nice. I tested it and it works.

from gesundheit.

kamholz avatar kamholz commented on July 28, 2024

Is there any way to use this tuple helper to create a join condition?

from gesundheit.

kamholz avatar kamholz commented on July 28, 2024

Nevermind, it's possible to specify multiple JOIN conditions by giving multiple keys in on: {...}. Duh.

from gesundheit.

grncdr avatar grncdr commented on July 28, 2024

😄
being focused on the tuple functionality, I had missed that too and was writing a longer response. If you ever need something crazy in a join condition, you can pass a Node object (e.g. a comparison method call chain) instead of an object literal for on:.

from gesundheit.

Related Issues (20)

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.