Skip to content

Commit

Permalink
updating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhibas committed Feb 22, 2024
1 parent da2ee3a commit 08a0380
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 40 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
.DS_Store
.idea
62 changes: 36 additions & 26 deletions Flagfile.example
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
FF-feature-complex-ticket-234234 {
// this is yet another
a = b and c=d and (dd not in (1,2,3) or z == "demo car"): true

// this is other
z == "demo car": false

// demo this
g in (4,5,6) and z == "demo car": true

// demo comment
model in (ms,mx,m3,my) and created >= 2024-01-01
and demo == false: true

false
}

// once you dont have rules you can use short notation to return boolean
FF-feature-flat-on-off -> true

// you can return non-boolean in this example json
// you can return non-boolean in this example json. or empty json object json({})
FF-feature-json-variant -> json({"success": true})

// feature with one rule
// returns true for NL country, else false
// features are forced to start with FF- case-sensitive as it allows you later to find all flags through in codebase
FF-feature-name-specifics -> false

// you can have feature with multiple rules in it with default flag value returned in end
FF-feature-y {
// if country is NL return True
countryCode == NL: true
// else default to false
false
}

// demo
FF-some-other -> true

// feature with inside commments and works like scheduler
// you can also return different variations (non-boolean) as example json
FF-testing {
// testing
// default variant
json({"success": true})
}

// simple flat on-off flags still can be written as a functions
// and have more complex feature with multiple rules in it, which at the end defaults to false
FF-feature-complex-ticket-234234 {
// complex bool expression
a = b and c=d and (dd not in (1,2,3) or z == "demo car"): true

// another one
z == "demo car": false

// with checking more
g in (4,5,6) and z == "demo car": true

// and multi-line rule works
model in (ms,mx,m3,my) and created >= 2024-01-01
and demo == false: true

false
}

// different kind of comments inside
FF-feature1 {
/* comment like this */
true
Expand All @@ -46,3 +48,11 @@ FF-feature1 {
json({})
}

/* this is multi-line commented feature
FF-timer-feature {
// turn on only on evaluation time after 22nd feb
NOW() > 2024-02-22: true
false
}
*/

27 changes: 19 additions & 8 deletions docs/TODO.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
- [+] Atom parsing for Date
- [+] Date converted to chrono datetime for comparison later
- [+] Scopes and negated scopes. ex.: a=b and !(c=d or g=z)
- [+] either lower() or upper() function calls or case insensitive string comparison operators
- [+] support for single quote strings
- [+] evaluation with provided context
- [+] date comparisons
# TODO

items tracking to be done

Still todo

- [ ] date > timestamp comparison
- [ ] parse NOW function
- [+] parse comments in function body under rules
- [ ] evaluator for Flagfile
- [ ] restructure and rename project into Flagfile.rs / into workspaces

Done

- [x] Atom parsing for Date
- [x] Date converted to chrono datetime for comparison later
- [x] Scopes and negated scopes. ex.: a=b and !(c=d or g=z)
- [x] either lower() or upper() function calls or case insensitive string comparison operators
- [x] support for single quote strings
- [x] evaluation with provided context
- [x] date comparisons
- [x] parse comments in function body under rules
12 changes: 6 additions & 6 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Roadmap

for the fullblown project Flagfile follow same bottom up technique just like NOM parsing bottom up :D
for the full-blown project Flagfile follow same bottom up technique just like NOM parsing bottom up :)

## sequence of events

1. create parser and evaluator for boolean expressions
2. create parser and evaluator for Flagfile
3. finilize api for parsing and evaluating both
1. create parser and evaluator for boolean expressions (DONE)
2. create parser and evaluator for Flagfile (IN PROGRESS)
3. finalize api for parsing and evaluating both
4. publish them as cargo libs
5. export WASM and FFI
6. create demo ffi lib in lets say c# .net core
7. create simple UI to create and update Flagfile on web
8. create sidecar container with storage of Flagfile in git/filesystem/cdn configurable
expose same through either restful/grpc/redis custom command
9. create fullblown UI multitenant and projects, envs and stuff to serve Flagfile through cdn
expose same through either restful/grpc/redis custom command
9. create full-blown UI multi-tenant and projects, envs and stuff to serve Flagfile through cdn
10. create clientside libs through ffi in other popular languages

0 comments on commit 08a0380

Please sign in to comment.