{"id":22532034,"url":"https://github.com/avionik-world/database-simplified","last_synced_at":"2025-08-04T01:31:33.530Z","repository":{"id":228410264,"uuid":"773872726","full_name":"avionik-world/database-simplified","owner":"avionik-world","description":"Simplified ArangoDB, RabbitMQ, Morphia and Jedis integration","archived":false,"fork":false,"pushed_at":"2024-08-04T13:06:23.000Z","size":130,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-08-04T15:07:17.144Z","etag":null,"topics":["arangodb","jedis","limbo","minecraft","morphia","paper","rabbitmq","spigot","velocity"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avionik-world.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-03-18T14:48:23.000Z","updated_at":"2024-08-04T13:06:26.000Z","dependencies_parsed_at":"2024-04-26T10:47:49.507Z","dependency_job_id":"72857f36-d243-4f32-ab0f-db49c9f2a7e8","html_url":"https://github.com/avionik-world/database-simplified","commit_stats":null,"previous_names":["avionik-world/database-simplified"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avionik-world%2Fdatabase-simplified","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avionik-world%2Fdatabase-simplified/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avionik-world%2Fdatabase-simplified/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avionik-world%2Fdatabase-simplified/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avionik-world","download_url":"https://codeload.github.com/avionik-world/database-simplified/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228576932,"owners_count":17939648,"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":["arangodb","jedis","limbo","minecraft","morphia","paper","rabbitmq","spigot","velocity"],"created_at":"2024-12-07T08:09:34.162Z","updated_at":"2024-12-07T08:09:34.737Z","avatar_url":"https://github.com/avionik-world.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Database Simplified 🤙\nHere you can easily set up and use ArangoDB, RabbitMQ, Morphia and Jedis.\n\n## Using Database Simplified in your plugin\n\n### Maven\n```xml\n\u003cdependencies\u003e\n \u003cdependency\u003e\n    \u003cgroupId\u003eworld.avionik\u003c/groupId\u003e\n    \u003cartifactId\u003edatabase-simplified\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.0\u003c/version\u003e\n    \u003cscope\u003eprovided\u003c/scope\u003e\n  \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n### Gradle\n```groovy\ndependencies {\n    compileOnly 'world.avionik:database-simplified:1.1.0'\n}\n```\n\n## How to create a new Configuration\nThere are two different ways to enter your sensitive data during setup. You can either use a **config file** in which you configure your database or simply use the **system environments**.\n\n``` kotlin\nDatabaseSimplifiedKit.createConfiguration()\n    .withMorphia(MorphiaSettings.fromConfig()) // Of course you can also use fromEnv() here\n    .withJedis(JedisSettings.fromEnv()) // Of course you can also use fromConfig() here\n    .withArango(ArangoSettings.fromKubeSecret()) // Of course you can also use fromEnv() here\n    .withRabbitMQ(RabbitMQSettings.fromConfig()) // Of course you can also use fromEnv() here\n    .start()\n```\n\n### \nIf you are wondering how to create a new Morphia database, then you have come to the right place. Here are also two examples of how to create such a database.\n\n```kotlin\nval morphiaDatastore = DatabaseSimplifiedKit.instance.createMorphiaDatastore(\"dbName\")\n\n// Create a new database with kotlin extensions\nval morphiaDatastore = createMorphiaDatastore(\"dbName\")\n```\n\n\n## How to use the MorphiaRepository \nFirst of all, you need an entity class. Let's take this class as an example:\n``` kotlin\n@Entity(\"test_entity\")\nclass TestEntity(\n    @Id val uniqueId: UUID,\n    val firstString: String\n)\n```\n\nThis is what a new repository could look like now. The UUID serves as an **identifier** for the entity.\n``` kotlin\nclass TestEntityRepository(\n    datastore: Datastore\n) : AbstractMorphiaRepository\u003cUUID, TestEntity\u003e(\n    datastore,\n    TestEntity::class.java\n)\n```\n\nYou now have various options for using your entity. You can retrieve all entities or create and delete new ones.\n\n``` kotlin\nclass TestEntityRepository(\n    datastore: Datastore\n) : AbstractMorphiaRepository\u003cUUID, TestEntity\u003e(\n    datastore,\n    TestEntity::class.java\n) {\n    \n    init {\n        val entityUniqueId = UUID.randomUUID()\n\n        // Gets you all entities from this repository\n        findAll().thenAccept { \n            listOf(it.toList())\n        }\n\n        // Would you like to get your entity class with an identifier? Here's how:\n        findOrNull(entityUniqueId).thenAccept { \n            println(it?.uniqueId)\n        }\n\n        // You can save a new entity to the repository as follows\n        val newEntity = TestEntity(entityUniqueId, \"second\")\n        save(newEntity)\n        \n        // You can use this to remove an entity. entityUniqueId is the identifier of the class \n        remove(entityUniqueId)\n    }\n    \n}\n```\n\n\n## How to use the JedisRepository \nHere, too, you need an entity class. Here is the example:\n``` kotlin\nclass TestEntity(\n    val firstString: String,\n    val secondString: String\n)\n```\n\nThe repository looks almost exactly like the Morphia repository. The only difference is that there is a **database pattern** instead of an identifier. This pattern is placed in front of the Jedis key.\n``` kotlin\nclass TestEntityRepository : AbstractJedisRepository\u003cTestEntity\u003e(\n    TestEntity::class.java,\n    \"test_entity\" // Here is the database pattern\n)\n```\n\nJust like with the Morphia repository, you can let off steam here. You can retrieve all entities or create and delete new ones.\n\n``` kotlin\nclass TestEntityRepository : AbstractJedisRepository\u003cTestEntity\u003e(\n    TestEntity::class.java,\n    \"test_entity\" // Here is the database pattern\n) {\n\n    init {\n        // Gets you all entities from this repository\n        findAll().forEach {\n            listOf(it.firstString)\n        }\n\n        // Would you like to get your entity class with an key? Here's how:\n        val entity = find(\"jedis_key\")\n        println(entity?.firstString)\n\n        val newEntity = TestEntity(\"Hello\", \"Second\")\n        insert(\"jedis_key\", newEntity)\n\n        // You can use this to remove an entity. jedis_key is the jedis key.\n        remove(\"jedis_key\")\n    }\n    \n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favionik-world%2Fdatabase-simplified","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favionik-world%2Fdatabase-simplified","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favionik-world%2Fdatabase-simplified/lists"}