by giorgioz · 5y ago · 0 comments
var createP = client.query( q.Create( q.Collection('test'), { data: { testField: 'testValue' } } ) )
https://docs.fauna.com/fauna/current/drivers/javascript
Why those capitalized functions names .Create() and .Collection()? Also the fact that you have to pass around that q. Maybe that could be changed with: let { Create, Collection} = q
I care about the syntax of the libraries I use and Fauna seems clumsy.
But it's just sugar, I basically write it the way you mentioned, by deconstructing `q`. See https://github.com/Vadorequest/rwa-faunadb-reaflow-nextjs-ma...
The snippet in the grandparent post is JavaScript; is there an ORM or other library that has an example of an idiomatic JS or Typescript syntax that either of you would prefer?
> ‘r.table(“users”).filter(u => u(“email”).match(“.*@gmail.com$”)).run(conn)’
I find all those capitalized functions in Fauna weird. In most C based languages like Javascript functions are lowercase.
Would it be possible for the Fauna JS wrapper to also accept lowercased functions?
Yeah, I do that all the time. It makes FQL code much cleaner.