{"id":15134844,"url":"https://github.com/jetbrains/xodus-dnq","last_synced_at":"2025-04-04T19:13:41.164Z","repository":{"id":26928638,"uuid":"72845430","full_name":"JetBrains/xodus-dnq","owner":"JetBrains","description":"Data definition and queries Kotlin DSL over Xodus","archived":false,"fork":false,"pushed_at":"2025-03-10T08:22:46.000Z","size":3444,"stargazers_count":86,"open_issues_count":7,"forks_count":25,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-04T19:13:17.872Z","etag":null,"topics":["database","hub","kotlin","nosql","xodus","xodus-dnq","youtrack"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JetBrains.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-04T12:22:43.000Z","updated_at":"2024-08-28T13:14:00.000Z","dependencies_parsed_at":"2024-03-13T14:27:52.244Z","dependency_job_id":"ec259457-13c1-4c2e-afbf-49be56f7ad54","html_url":"https://github.com/JetBrains/xodus-dnq","commit_stats":{"total_commits":1490,"total_committers":36,"mean_commits":"41.388888888888886","dds":0.8087248322147651,"last_synced_commit":"937b2963a808aaea04bd8d615c3db3bd4df7cf28"},"previous_names":[],"tags_count":78,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JetBrains%2Fxodus-dnq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JetBrains%2Fxodus-dnq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JetBrains%2Fxodus-dnq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JetBrains%2Fxodus-dnq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JetBrains","download_url":"https://codeload.github.com/JetBrains/xodus-dnq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234923,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","hub","kotlin","nosql","xodus","xodus-dnq","youtrack"],"created_at":"2024-09-26T05:40:17.589Z","updated_at":"2025-04-04T19:13:41.138Z","avatar_url":"https://github.com/JetBrains.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![Xodus-DNQ](docs/images/XodusDNQ.png)\n \n[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jetbrains.xodus/dnq/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.jetbrains.xodus/dnq)\n[![Build Status](https://travis-ci.org/JetBrains/xodus-dnq.svg?branch=master)](https://travis-ci.org/JetBrains/xodus-dnq)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)\n![Pure Java + Kotlin](https://img.shields.io/badge/100%25-java%2bkotlin-orange.svg)\n[![Stack Overflow](https://img.shields.io/badge/stack%20overflow-xodus--dnq-brightgreen.svg)](https://stackoverflow.com/questions/tagged/xodus-dnq)\n\nXodus-DNQ is a Kotlin library that contains the data definition language and queries for \n[Xodus](https://github.com/JetBrains/xodus), a transactional schema-less embedded database. \nXodus-DNQ provides the same support for Xodus that ORM frameworks provide for SQL databases. \nWith Xodus-DNQ, you can define your persistent meta-model using Kotlin classes.\n\nJetBrains team tools [YouTrack](https://jetbrains.com/youtrack) and [Hub](https://jetbrains.com/hub) use Xodus-DNQ for \npersistent layer definition.\n\nMore documentation https://jetbrains.github.io/xodus-dnq.\n\n## Quick Start Guide\n\n### Install to your project\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jetbrains.xodus/dnq/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.jetbrains.xodus/dnq)\n\nList of released versions is available at https://github.com/JetBrains/xodus-dnq/releases.\n\n#### Gradle\n```groovy\nrepositories {\n    mavenCentral()\n}\ncompile 'org.jetbrains.xodus:dnq:${version}'\n```\n#### Maven\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.jetbrains.xodus\u003c/groupId\u003e\n    \u003cartifactId\u003ednq\u003c/artifactId\u003e\n    \u003cversion\u003e$version\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Use Xodus-DNQ\n[See code in repository](https://github.com/JetBrains/xodus-dnq/blob/master/dnq/src/test/kotlin/kotlinx/dnq/sample/SampleShortApp.kt).\n```kotlin\n// Define persistent class. It should extend XdEntity\nclass XdPost(entity: Entity) : XdEntity(entity) {\n    //  and have component object of type XdEntityType\n    companion object : XdNaturalEntityType\u003cXdPost\u003e()\n\n    // Define persistent property of type org.joda.time.DateTime?\n    var publishedAt by xdDateTimeProp()\n\n    // Define required persistent property of type String\n    var text by xdRequiredStringProp()\n}\n\nclass XdBlog(entity: Entity) : XdEntity(entity) {\n    companion object : XdNaturalEntityType\u003cXdBlog\u003e()\n\n    // Define multi-value link to XdPost\n    val posts by xdLink0_N(XdPost)\n}\n\nfun main(args: Array\u003cString\u003e) {\n    // Register persistent classes\n    XdModel.registerNodes(XdPost, XdBlog)\n\n    // Initialize Xodus persistent storage\n    val xodusStore = StaticStoreContainer.init(\n            dbFolder = File(System.getProperty(\"user.home\"), \".xodus-dnq-blog-db\"),\n            environmentName = \"db\"\n    )\n\n    // Initialize Xodus-DNQ metadata\n    initMetaData(XdModel.hierarchy, xodusStore)\n\n    // Do in transaction\n    val blog = xodusStore.transactional {\n        // Find an existing blog in database\n        XdBlog.all().firstOrNull()\n                // or create a new one if there are no blogs yet\n                ?: XdBlog.new()\n    }\n\n    xodusStore.transactional {\n        // Create new post\n        val post = XdPost.new {\n            this.publishedAt = DateTime.now()\n            this.text = args.firstOrNull() ?: \"Empty post\"\n        }\n\n        // Add new post to blog\n        blog.posts.add(post)\n    }\n\n    // Do in read-only transaction\n    xodusStore.transactional(readonly = true) {\n        // Print all blog posts\n        for (post in blog.posts) {\n            println(\"${post.publishedAt}: ${post.text}\")\n        }\n    }\n}\n```\n\n## Find out more\n- [Read documentation](https://jetbrains.github.io/xodus-dnq)\n- [Report an issue](https://github.com/JetBrains/xodus-dnq/issues/new)\n- [Ask question at Stack Overflow](https://stackoverflow.com/questions/tagged/xodus-dnq)\n- [Learn more about Xodus](https://github.com/JetBrains/xodus)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetbrains%2Fxodus-dnq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjetbrains%2Fxodus-dnq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetbrains%2Fxodus-dnq/lists"}