Skip to content

smallshen/Xodus-NQ

Repository files navigation

Xodus-NQ

Typesafe DSL for Xodus based on the new context receivers

Inspired by Xodus-DNQ

Goals:

  • Typesafe
  • Lightweight
  • Better Output(smaller Java Bytecode output)

Example

See Example

See Code Generation Example

Create a new entity

store.executeInTransaction {
    with(it) {
        val newEntity = TestGeneratedEntity(
            name = "test",
            uid = "testUid",
            email = "test@eridani.club",
            age = 23,
            gender = "Male",
            bio = "Hi, this is dsl testing."
        )
    }
}

Query

store.executeInTransaction {
    with(it) {
        val testEntities = TestGeneratedEntity.query {
            (name eq "test") or (name startWith "t")
        }
        val anotherQueryX = TestGeneratedEntity { name startWith "x" }
        val anotherQueryY = TestGeneratedEntity { name startWith "y" }
        val anotherQueryZ = TestGeneratedEntity { name startWith "z" }
        val queryOperation = ((anotherQueryX or anotherQueryY) and anotherQueryZ) + testEntities
        queryOperation.forEach {
            println(it.name)
        }
    }
}

Smaller Java Bytecode Output

  • Use inline value classes
  • Use inline methods

TODO

  • Basic Examples
  • DSL Marker Annotation
  • Entity Link dsl
  • All Query builder
  • Source Code Generation
  • Generate through Kotlin Compiler Plugin

Related

Releases

No releases published

Packages

No packages published

Languages