Skip to content

Commit

Permalink
Merge pull request #2 from cube2222/readme-types
Browse files Browse the repository at this point in the history
Readme types
  • Loading branch information
cube2222 authored Dec 30, 2019
2 parents 658b9b5 + bd7580c commit 2ba5f13
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Well, at least that's what led me here. And that's why I've written **jql**, a j

If you want to see **benchmarks**, they're at [the end of the README.](#Benchmarks)

If you want to see a cheatsheet with function types, it's [right before the benchmarks](#Type-Cheatsheet).

Ok, let's check it out now, but first things first, you have to install it:
```
go get github.com/cube2222/jql
Expand Down Expand Up @@ -488,6 +490,33 @@ Moreover, I hope it's not the end of it! Hordes of JSON blobs still await and I

Issues, ⭐️stars⭐️, comments, messages, reviews, benchmarks, you name it! - all are very appreciated! 😉

# Type Cheatsheet
```
JSON: Any value
Expression[T]: (JSON -> T)
Expression can be seen as a Continuation
elem:
With one arg: (Expression[Position]) -> (Expression[JSON]) = (elem position (id))
With two args: (Expression[Position] x Expression[T]) -> (Expression[T])
keys: () -> (Expression[JSON])
id: () -> (Expression[JSON])
array: (Expression[T]...) -> (Expression[Array[T]]) (T's can vary)
object: ((Expression x Expression[T])...) -> (Expression[T])
pipe: (Expression...) -> (Expression)
sprintf: (Expression[String] x Expression[T]...) -> (Expression[String])
join: (Expression[T]...) -> (Expression[String])
filter: (Expression[Bool]) -> (Expression[JSON])
eq,lt,gt: (Expression x Expression) -> (Expression[Bool])
range:
With one arg: (Expression[Int]) -> (Expression[Array[Int]])
With two args: (Expression[Int] x Expression[Int]) -> (Expression[Array[Int]])
and,or: (Expression[Bool]...) -> (Expression[Bool])
not: (Expression[Bool]) -> (Expression[Bool])
ifte: (Expression[Bool] x Expression[A] x Expression[B]) -> (Expression[A|B])
error: (Expression[JSON]) -> (!)
recover: (Expression[JSON]) -> (Expression[JSON])
```

# Benchmarks

This is a fairly synthetic benchmark (it's the first that came to my mind), so I won't say **jql** is faster than jq. Especially since jq has various much more advanced functionalities.
Expand Down

0 comments on commit 2ba5f13

Please sign in to comment.