{"id":18829435,"url":"https://github.com/spokanetech/exploring_orms","last_synced_at":"2026-01-27T14:03:24.308Z","repository":{"id":248609353,"uuid":"829178875","full_name":"SpokaneTech/exploring_orms","owner":"SpokaneTech","description":"Exploring Go GORM and Django ORM","archived":false,"fork":false,"pushed_at":"2024-10-04T04:49:03.000Z","size":205,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-30T06:25:00.128Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://spokanetech.github.io/exploring_orms/","language":"HTML","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/SpokaneTech.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-07-15T23:21:19.000Z","updated_at":"2024-10-04T04:49:07.000Z","dependencies_parsed_at":"2024-11-08T01:44:59.077Z","dependency_job_id":"1f933439-4409-4f0f-a6a2-456f94f5039f","html_url":"https://github.com/SpokaneTech/exploring_orms","commit_stats":null,"previous_names":["spokanetech/exploring_orms"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpokaneTech%2Fexploring_orms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpokaneTech%2Fexploring_orms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpokaneTech%2Fexploring_orms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpokaneTech%2Fexploring_orms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpokaneTech","download_url":"https://codeload.github.com/SpokaneTech/exploring_orms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239765149,"owners_count":19693088,"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":[],"created_at":"2024-11-08T01:44:49.070Z","updated_at":"2026-01-23T16:30:20.999Z","avatar_url":"https://github.com/SpokaneTech.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\nmarp: true\ntheme: gaia\nstyle: |\n  .columns {\n    display: grid;\n    grid-template-columns: repeat(2, minmax(0, 1fr));\n    gap: 1rem;\n  }\n  section.small {\n    font-size: 22px;\n  }\n---\n\n## Exploring GORM: The Fantastic ORM for Go\n\nand the Django ORM for all you Pythonistas\n\n---\n\n## Agenda\n\nWe'll cover three main ideas:\n\n- What is an ORM and why should you be using one?\n- How to use GORM\n- How does GORM compare to other popular ORMs\n  \t- Django ORM\n\n---\n\n## What is an ORM?\n\n**Object–relational mapping** is a technique for converting between relational databases and object-oriented programming languages.\n\n| Database | Code |\n| --- | --- |\n| Table | Class / Model |\n| Column | Field / Attribute |\n| Relationships | Field / Attribute |\n\n---\n\n## Why use an ORM?\n\n- Typed interaction with your database\n- Speed up development time\n- Prevent SQL-injection\n- Auto migrations\n- ➖ Higher level abstraction\n- ➖ Can lead to poor performance (N+1, etc.)\n\n---\n\n## Relationships\n\n- has one / belongs to\n- has many\n- many to many\n- polymorphism\n- single-table inheritance\n\n---\n\n## Demo — Cars\n\n- has one\n    - vehicle and driver\n- has many\n    - vehicle and model\n    - model and manufacturer\n- many to many\n    - model and parts\n- polymorphism: gas and electric vehicles\n- single-table inheritance\n\n---\n\n## Has many\n\n\u003cdiv class=\"columns\"\u003e\n\u003cdiv\u003e\n\n- A `manufacturer` has many `vehicles`\n\n\u003c/div\u003e\n\u003cdiv\u003e\n\n![width:600px](./docs/mermaid-1-simple.png)\n\n\u003c/div\u003e\n\u003c/div\u003e\n\n---\n\n## Many to many\n\n\u003cdiv class=\"columns\"\u003e\n\u003cdiv\u003e\n\n- A `part` can fit many `vehicles` and a `vehicle` can have many `parts`\n- When using GORM AutoMigrate, GORM will create join tables automatically\n\n\u003c/div\u003e\n\u003cdiv\u003e\n\n![width:600px](./docs/mermaid-2-parts.png)\n\n\u003c/div\u003e\n\u003c/div\u003e\n\n---\n\n## Has one\n\n\u003cdiv class=\"columns\"\u003e\n\u003cdiv\u003e\n\n- A `vehicle` has one driver, a `person`\n\n\u003c/div\u003e\n\u003cdiv\u003e\n\n![width:600px](./docs/mermaid-3-drivers.png)\n\n\u003c/div\u003e\n\u003c/div\u003e\n\n---\n\n\u003c!-- _class: small --\u003e\n\n## SQL vs. GORM vs. Django ORM functions\n\n| SQL | GORM | GORM Gen | Django |\n| --- | --- | --- | --- |\n| SELECT * | `db.Select()` | `q.Person.Select()` | `queryset.all()` |\n| SELECT name | `db.Select(\"name\")` | `q.Person.Select(q.Person.Name)` | `queryset.values(\"name\")` |\n| WHERE name = 'Joe' | `db.Where(\"name=?\",\"Joe\")` | `q.Person.Where( q.Person.Name.Eq(\"Joe\"))` | `queryset.filter(name=\"Joe\")` |\n| LIMIT | `.Limit(10)` | `q.Person.Limit(10)` | `qs[:10]` |\n\n---\n\n## Repository pattern\n\n---\n\n## Active record vs. Data mapper\n\n---\n\n## Resources\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspokanetech%2Fexploring_orms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspokanetech%2Fexploring_orms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspokanetech%2Fexploring_orms/lists"}