{"id":18209030,"url":"https://github.com/kdabir/gstorm","last_synced_at":"2025-04-02T17:32:10.566Z","repository":{"id":2822796,"uuid":"3824830","full_name":"kdabir/gstorm","owner":"kdabir","description":"A simple ORM for databases and CSV files. Intended to be used in groovy scripts and small projects","archived":false,"fork":false,"pushed_at":"2022-03-28T03:07:07.000Z","size":431,"stargazers_count":82,"open_issues_count":28,"forks_count":13,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-17T09:11:23.244Z","etag":null,"topics":["csv","groovy","hacktoberfest","hacktoberfest2021","orm"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kdabir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-25T14:45:33.000Z","updated_at":"2024-05-02T13:42:04.000Z","dependencies_parsed_at":"2022-08-26T06:21:27.785Z","dependency_job_id":null,"html_url":"https://github.com/kdabir/gstorm","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdabir%2Fgstorm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdabir%2Fgstorm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdabir%2Fgstorm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdabir%2Fgstorm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdabir","download_url":"https://codeload.github.com/kdabir/gstorm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246860173,"owners_count":20845622,"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":["csv","groovy","hacktoberfest","hacktoberfest2021","orm"],"created_at":"2024-11-03T14:03:51.611Z","updated_at":"2025-04-02T17:32:10.210Z","avatar_url":"https://github.com/kdabir.png","language":"Groovy","funding_links":[],"categories":["Database"],"sub_categories":[],"readme":"GStorm - Groovy Single Table ORM\n---\nGStorm is a light-weight persistence helper that lets you persist data without any boilerplate code. Also it can act as\nand ORM for CSV files.\n\n#### Example\n```groovy\nclass Person { String name, project }       // this is your model class\n\ndef g = new Gstorm()\ng.stormify(Person)                          // table automatically gets created for this class\n\ndef person = new Person(name: \"kunal\", project: \"gstorm\")\n\nperson.save()                               // which saves object to db\n\ndef result = Person.where(\"name = 'kunal'\") // pass any standard SQL where clause\nprintln result\n\nprintln \"all records -\u003e ${Person.all}\"      // get all objects from db\n\nperson.name = \"kunal dabir\"\nperson.save()                               // saves the object back to db\n\nprintln Person.get(person.id)               // loads the object by id\n\nperson.delete()                             // delete the person from db\n\n```\n\n#### Running it\nTo see gstorm in action just execute following from command line:\n\n```bash\ngroovy https://raw.github.com/kdabir/gstorm/master/examples/getting_started.groovy\n``` \n\nProvided you have [groovy installed](http://groovy-lang.org/install.html), you don't need to install\nanything else.\n\n----\n\n### Why Gstorm?\n\nIn groovy scripts, when you need persistence, and you often feel hibernate is overkill but handwritten SQL is headache.\nYou don't want to connect to external Database server and still wish you could just create a table and save objects as\nquickly as possible. You hate writing SQL for trivial CRUD but still want to be able to harness the power of SQL when\nneed be. You can then try Gstorm.\n\nGstorm take very simple approach to solve this problem by focusing just on needs of persistence mechanism required for\nsmall scripts/projects.\n\nThe market is already flooded with ORMs and NoSQL databases. It's pointless to introduce anything that's heavy, complex,\nrigid and tries to solve all the problems in the world.\n\n#### What good a Single Table ORM would do? \n\n- Creates Tables for you\n- Allows you to persist objects without worrying about CRUD SQL statements\n- Very light layer, no jar baggage\n- Can still fire complex SQL queries that would have been difficult in NoSQL or plain collection backed DBs\n- Typically this would be useful in scripts, Not in multi-layered web applications or any complex use cases\n- Doesn't handle any relationships or complex data types\n\nGstorm uses HSQLDB syntax internally.\n\n---\n\n## Getting started\n\nGStorm is available in [jcenter](http://jcenter.bintray.com/io/github/kdabir/gstorm/gstorm) repository\nGrab GStorm using \n\n```groovy\n@GrabConfig(systemClassLoader = true)\n@Grab('io.github.kdabir.gstorm:gstorm:0.7.1')\n```\n\nCreate instance of `Gstorm`\n\n```groovy\ndef g = new Gstorm()\n```\n\nYou may pass optionally pass object of `java.sql.Connection` or `groovy.sql.Sql`\n\n```groovy\ndef g = new Gstorm(sql)\n```\n\nwhere `sql` is an instance of `groovy.sql.Sql`\n\nAnd gstormify your model\n\n```groovy\ng.stormify(Person)\n```\n\n\nJust go through the [example's source ](examples) and [test](test/gstorm) and have fun.\n\n---\n\n## Project status\n\n\nGstorm is tiny project with very specific use case. There is long list of items that I would want to complete before calling it\nfeature complete. The project is under active development and is not yet suitable for production grade applications.\n\n## Changelog :\n\n### v0.7.1\n- infrastructural changes to build and release\n- added to jcenter repo\n\n### v0.7\n- support `@WithoutId` annotation to map to tables that do not have any id field and hence classes will not have id specific methods\n- first cut of support for `@Csv` annotation to open CSV files as table. File can be set using `setCsvFile()` method of Gstorm.\n- capability to provide custom type mappings as well changing the default type mapping if no type mapping is found\n- ability to chain `stormify` and return the `Gstorm` instance\n\n### v0.6\n - support `count()` method and `count` property on Model class. `count(clause)` can take a where like condition\n - support `Gstorm(Connection)` which can take `java.sql.Connection` object\n - support `Gstorm()` constructor which create in memory db (HSQLDB) automatically\n - support `Gstorm(dbpath)` constructor which creates HSQLDB with the specified file path\n - add `hsqldb` as compile/runtime dependency to project, so it will be used by default. User can always exclude it if it's not required.\n\n### v0.5\n - support `@Id` annotation. limitation: The id has to be a numeric (Integer) field in class\n - heavy refactoring internally, keeping the api intact\n\n### v0.4\n - support primitive numbers (`int`/`long`). Floating point numbers are stored as string as of yet.\n - Support table name to be different from the class name. Class can be annotated with `@Table(\"TABLE_NAME\")` to specify table name.\n - support date/time to be stored.\n - internal refactoring\n\n### v0.3\n - `enableQueryLogging` to enable sql query logging\n - `get()` to load a model by id\n\n### v0.2\n - autogenerated `id` property on model\n - ability to `update()` or `save()` when model has `id`\n - using gradle to publish to maven repo\n - travis ci\n - added `all` method/property\n\n### v0.1\n - initial prototype\n - `save()` and `where()` methods added\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdabir%2Fgstorm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdabir%2Fgstorm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdabir%2Fgstorm/lists"}