atropos

command module
v0.0.0-...-f783f3f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2021 License: BSD-3-Clause, MIT Imports: 5 Imported by: 0

README

Atropos

codecov

Atropos is a DSL for edit JSON struct.

Design

Antlr for grammar

We need a DSL can edit JSON result according to the http request.

Using in client strategy deliver basically.

Assignment

a = 1
b = ['test', 2, false]
c = [b, ['test2', 4, true]]
c[2] = 3
c[0][1] = 3

// stuct must defiened outside
input.a = 1

Expression

a == 4 
a != 4
a > 4
a >= 4
a < 4
a <= 4
a regexpMatch '\d'
a = a + b
a = a - b
a = a * b
a = a / b
a = a % b
a = !a
a = -a
a = a * (a + a)
a contains b // is set a contains b, b could be an array or an object
a !contains b // is set a not contains b, b could be an array or an object
a && b
a || b
a && (b || c)

If statement

if expression then
// do something
end

if expression then
// do something
elseif expression then
// do something
end

if expression then
// do something
else
// do something
end

Return

return anywhere

return

Function

a.count()
a.avg()
a.max()
a.min()
a.sum()

More

read and run in example_test.go for more examples

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL