8000 GitHub - maciejtarnowski/serification: serializable + specification = serification
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

maciejtarnowski/serification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serification

serializable + specification = serification

Problem

  • Serializing Specifications to JSON and SQL, unserializing JSON to Specifications

Example

Converting:

package main

var spec = PostCreatedBetween("2020-01-01", "2020-01-31").And(PostHasTags("tag_A", "tag_B").Or(PostHasTags("tag_A", "tag_C")))

into:

{
  "type": "and",
  "left": {
    "type": "post_created_between",
    "lower": "2020-01-01",
    "upper": "2020-01-31"
  },
  "right": {
    "type": "or",
    "left": {
      "type": "post_has_tags",
      "tags": ["tag_A", "tag_B"]
    },
    "right": {
      "type": "post_has_tags",
      "tags": ["tag_A", "tag_C"]
    }
  }
}

and vice versa.

License

MIT

About

serializable + specification = serification

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0