{"id":24638244,"url":"https://github.com/miyamo2/dynmgrm","last_synced_at":"2025-05-08T23:44:45.871Z","repository":{"id":229766322,"uuid":"769688932","full_name":"miyamo2/dynmgrm","owner":"miyamo2","description":"GORM DynamoDB Driver","archived":false,"fork":false,"pushed_at":"2025-05-05T17:12:37.000Z","size":1571,"stargazers_count":23,"open_issues_count":22,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T23:44:38.174Z","etag":null,"topics":["aws","aws-dynamodb","dynamo","dynamodb","go","golang","gorm","orm","orm-library","partiql"],"latest_commit_sha":null,"homepage":"","language":"Go","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/miyamo2.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-09T19:23:00.000Z","updated_at":"2025-03-21T08:46:22.000Z","dependencies_parsed_at":"2024-04-16T13:50:51.805Z","dependency_job_id":"e78b799a-92e0-4832-bee5-53252fa6d5e6","html_url":"https://github.com/miyamo2/dynmgrm","commit_stats":null,"previous_names":["miyamo2/dynmgrm"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyamo2%2Fdynmgrm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyamo2%2Fdynmgrm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyamo2%2Fdynmgrm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyamo2%2Fdynmgrm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miyamo2","download_url":"https://codeload.github.com/miyamo2/dynmgrm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166473,"owners_count":21864467,"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":["aws","aws-dynamodb","dynamo","dynamodb","go","golang","gorm","orm","orm-library","partiql"],"created_at":"2025-01-25T10:13:31.158Z","updated_at":"2025-05-08T23:44:45.852Z","avatar_url":"https://github.com/miyamo2.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynmgrm - GORM DynamoDB Driver\n\n\u003cimg src=\".assets/logo/svg/dynmgrm_logo_with_caption.svg\" width=\"400\" alt=\"logo\"\u003e\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/miyamo2/dynmgrm.svg)](https://pkg.go.dev/github.com/miyamo2/dynmgrm)\n[![GitHub go.mod Go version (subdirectory of monorepo)](https://img.shields.io/github/go-mod/go-version/miyamo2/dynmgrm?logo=go)](https://img.shields.io/github/go-mod/go-version/miyamo2/dynmgrm?logo=go)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/miyamo2/dynmgrm)](https://img.shields.io/github/v/release/miyamo2/dynmgrm)\n[![codecov](https://codecov.io/gh/miyamo2/dynmgrm/graph/badge.svg?token=QLIVB3ESVD)](https://codecov.io/gh/miyamo2/dynmgrm)\n[![Go Report Card](https://goreportcard.com/badge/github.com/miyamo2/dynmgrm)](https://goreportcard.com/report/github.com/miyamo2/dynmgrm)\n[![GitHub License](https://img.shields.io/github/license/miyamo2/dynmgrm?\u0026color=blue)](https://img.shields.io/github/license/miyamo2/dynmgrm?\u0026color=blue)\n\ndynmgrm is the driver to issue PartiQL Statement to DynamoDB with GORM⚡\n\n## Features\n\n### Supports the following PartiQL statements\n\n- [x] Select\n  - [x] With Secondary Index\n  - [x] With `begins_with` function\n  - [x] With `contains` function\n  - [x] With `size` function\n  - [x] With `attribute_type` function\n  - [x] With `MISSING` operator\n- [x] Insert\n- [x] Update\n  - [x] With `SET` clause\n    - [x] With `list_append` function\n      - [x] `ListAppend()`\n    - [x] With `set_add` function\n    - [x] With `set_delete` function\n  - [ ] With `REMOVE` clause\n- [x] Delete\n- [x] Create Table ※ proprietary PartiQL syntax by [`miyamo2/godynamo`](https://github.com/miyamo2/godynamo)\n- [x] Create GSI ※ proprietary PartiQL syntax by [`miyamo2/godynamo`](https://github.com/miyamo2/godynamo)\n\n### Supports the following GORM features\n\n- Query\n  - [x] `Select`\n  - [x] `Find`\n  - [x] `Scan`\n\n- Update\n  - [x] `Update`\n  - [x] `Updates`\n  - [x] `Save`\n\n- Create\n  - [x] `Create`\n  \n- Delete\n  - [x] `Delete`\n\n- Condition\n  - [x] `Where`\n  - [x] `Not`\n  - [x] `Or`\n\n- Table/Model\n  - [x] `Table`\n  - [x] `Model` ※ Combination with Secondary Index are not supported.\n  \n- Transaction ※ Supports only Insert, Update, and Delete.\n  - [x] `Begin`\n  - [x] `Commit`\n  - [x] `Rollback`\n  - [x] `Transaction`\n\n- [Migration](.docs/MIGRATION.md)\n  - [ ] `AutoMigrate`\n  - [ ] `CurrentDatabase`\n  - [x] `FullDataTypeOf`\n  - [x] `CreateTable`\n  - [ ] `DropTable`\n  - [ ] `HasTable`\n  - [ ] `GetTables`\n  - [ ] `HasColumn`\n  - [ ] `ColumnTypes`\n  - [x] `CreateIndex`\n  - [ ] `DropIndex`\n  - [ ] `HasIndex`\n\n### Custom Clause\n\n- `SecondaryIndex`\n\n### Custom Serializer\n\n- `dynamo-nested`\n\n[What is about GORM Serializer?](https://gorm.io/docs/serializer.html)\n\n## Quick Start\n\n### Installation\n\n```sh\ngo get github.com/miyamo2/dynmgrm\n```\n\n### Usage\n\n\u003e [!TIP]\n\u003e\n\u003e `miyamo2/dynmgrm` is recommended to be used in with [`miyamo2/sqldav`](https://github.com/miyamo2/sqldav).\n\u003e \n\u003e [`miyamo2/sqldav`](https://github.com/miyamo2/sqldav) provides Defined Type of slice/map that implements `sql.Scanner` and `driver.Valuer`.\n\u003e \n\u003e These are as the equivalent to `Set`, `List`, `Map` and `TypedList` included in `miyamo2/dynmgrm` before `v0.9.0`.\n\n```go\npackage main\n\nimport (\n\t\"github.com/miyamo2/dynmgrm\"\n\t\"github.com/miyamo2/sqldav\"\n\t\"gorm.io/gorm\"\n)\n\ntype Event struct {\n\tName  string `gorm:\"primaryKey\"`\n\tDate  string `gorm:\"primaryKey\"`\n\tHost  string\n\tGuest sqldav.Set[string]\n}\n\nfunc main() {\n\tdb, err := gorm.Open(dynmgrm.New())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar dynamoDBWorkshop Event\n\tdb.Table(\"events\").\n\t\tWhere(`name=?`, \"DynamoDB Workshop\").\n\t\tWhere(`date=?`, \"2024/3/25\").\n\t\tScan(\u0026dynamoDBWorkshop)\n\n\tdynamoDBWorkshop.Guest = append(dynamoDBWorkshop.Guest, \"Alice\")\n\tdb.Save(\u0026dynamoDBWorkshop)\n\n\tcarolBirthday := Event{\n\t\tName: \"Carol's Birthday\",\n\t\tDate: \"2024/4/1\",\n\t\tHost: \"Charlie\",\n\t\tGuest: []string{\"Alice\", \"Bob\"},\n\t}\n\tdb.Create(carolBirthday)\n\n\tvar daveSchedule []Event\n\tdb.Table(\"events\").\n\t\tWhere(`date=?`, \"2024/4/1\").\n\t\tWhere(`( ? )`,\n\t\t\tdb.Where(`host=?`, \"Dave\").Or(`CONTAINS(\"guest\", ?)`, \"Dave\")).\n\t\tScan(\u0026daveSchedule)\n\n\ttx := db.Begin()\n\tfor _, event := range daveSchedule {\n\t\tif event.Host == \"Dave\" {\n\t\t\ttx.Delete(\u0026event)\n\t\t} else {\n\t\t\ttx.Model(\u0026event).Update(\"guest\", gorm.Expr(\"set_delete(guest, ?)\", sqldav.Set[string]{\"Dave\"}))\n\t\t}\n\t}\n\ttx.Model(\u0026carolBirthday).Update(\"guest\", gorm.Expr(\"set_add(guest, ?)\", sqldav.Set[string]{\"Dave\"}))\n\ttx.Commit()\n\n\tvar hostDateIndex []Event\n\tdb.Table(\"events\").Clauses(\n\t\tdynmgrm.SecondaryIndex(\"host-date-index\"),\n\t).Where(`host=?`, \"Bob\").Scan(\u0026hostDateIndex)\n}\n```\n\n## Contributing\n\nFeel free to open a PR or an Issue.\n\nHowever, you must promise to follow our [Code of Conduct](https://github.com/miyamo2/dynmgrm/blob/main/CODE_OF_CONDUCT.md).\n\nSee [here](https://github.com/miyamo2/dynmgrm/blob/main/CONTRIBUTING.md) for more details on contributing.\n\n## License\n\n**dynmgrm** released under the [MIT License](https://github.com/miyamo2/dynmgrm/blob/main/LICENSE)\n\n## Credits\n\n### Go gopher\n\nThe Go gopher was designed by [Renee French.](http://reneefrench.blogspot.com/)\nThe design is licensed under the Creative Commons 3.0 Attributions license.\nRead this article for more [details](https://go.dev/blog/gopher)\n\n### Special Thanks\n\n- [btnguyen2k/godynamo](https://github.com/btnguyen2k/godynamo)\n\n  `dynmgrm` connects to `database/sql` by `miyamo2/godynamo` that forked from `btnguyen2k/godynamo`.\n\n- [JetBrainsMono](https://github.com/JetBrains/JetBrainsMono)\n\n\tJetBrainsMono is used for the caption of the dynmgrm logo.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiyamo2%2Fdynmgrm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiyamo2%2Fdynmgrm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiyamo2%2Fdynmgrm/lists"}