Giter VIP home page Giter VIP logo

Comments (3)

chen-factual avatar chen-factual commented on June 24, 2024

Since the write needs the type, query and option sometime, it's very confusing if we still allow type to be placed in the top level of query object. We should just put the type in the query, insert or update, they can specify the type just for query or write.

I see what you're saying. I'd like type as a top level key for simple queries that are query only. So this would be a valid query:

{
  "type": "STANDARD",
  "field": "name",
  "match": "Bob"
}

The type here shouldn't really apply to writes, since values for type are things like AND and OR.

If anything, writes should have their own types, values being INSERT, UPDATE, and RAW. Does that sound reasonable?

from franca-js.

fanchen1988 avatar fanchen1988 commented on June 24, 2024

@chen-factual I see, so the reason I think keeping type at the top level might be confusing because we may assign different types for query and write(like update), for instance:

{
  "type": "RAW",
  "table": "example-table",
  "query": {
    "field": "field1",
    "match": "baz"
  },
  "upsert": {
    "$set": {
      "field2": "boo",
      "field3": "bar"
    },
    "$setOnInsert": {
      "field1": "baz",
      "field2": "boo",
      "field3": "bar"
    }
  }
}

So in this case, upsert is raw but query is just a standard query. Do you think we need this kind of query object in practice?

from franca-js.

chen-factual avatar chen-factual commented on June 24, 2024

I can see a corner use case for it, but in the interest of simplifying things I'd be glad if we enforce RAW to apply to everything, instead of selectively to just one or the other.

from franca-js.

Related Issues (13)

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.