{"id":34231325,"url":"https://github.com/lbernardo/go-database-odm","last_synced_at":"2026-03-14T03:01:45.817Z","repository":{"id":224850167,"uuid":"764400028","full_name":"lbernardo/go-database-odm","owner":"lbernardo","description":"Adapters ODM (Object Document Mappers) database clients","archived":false,"fork":false,"pushed_at":"2024-02-28T02:13:11.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-19T06:51:13.612Z","etag":null,"topics":["database","dynamodb","go","model","mongo","mongo-go-mo","mongodb"],"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/lbernardo.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-28T02:11:29.000Z","updated_at":"2025-02-04T17:46:03.000Z","dependencies_parsed_at":"2024-02-28T03:25:54.989Z","dependency_job_id":"5ce3ecb0-9c2f-42e9-abc4-2dd2eca465ba","html_url":"https://github.com/lbernardo/go-database-odm","commit_stats":null,"previous_names":["lbernardo/go-database-odm"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lbernardo/go-database-odm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbernardo%2Fgo-database-odm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbernardo%2Fgo-database-odm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbernardo%2Fgo-database-odm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbernardo%2Fgo-database-odm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lbernardo","download_url":"https://codeload.github.com/lbernardo/go-database-odm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbernardo%2Fgo-database-odm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30487204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-14T01:54:10.014Z","status":"online","status_checked_at":"2026-03-14T02:00:06.612Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","dynamodb","go","model","mongo","mongo-go-mo","mongodb"],"created_at":"2025-12-16T01:13:01.251Z","updated_at":"2026-03-14T03:01:45.808Z","avatar_url":"https://github.com/lbernardo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-database-odm\n\nAdapters ODM (Object Document Mappers) database clients\n\n## Install\n```shell\ngo get github.com/lbernardo/go-database-odm\n```\n\n## Usage\n\n\n`MongoDB adapter`\n```go\ndb, err := mongodb.NewMongodbAdapter(\u0026mongodb.Config{\n\t\tDatabaseName: \"database\",\n\t\tDatabaseUri:  \"mongodb://localhost:27017\",\n})\n```\n\n`DynamoDB adapter`\n```go\ndb, err := mongodb.NewMongodbAdapter(\u0026dynamodb.Config{\n    AwsRegion:   \"us-east-1\",\n    TablePrefix: \"table-dev-\", // is optional\n})\n```\n\n\n`Usage functions`\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/lbernardo/go-database-odm/pkg/adapters/mongodb\"\n\t\"log\"\n)\n\ntype Model struct {\n\t// Set table name with tag database, if not defined tableName\n\t// is model struct name in plural\n\t_     any    `database:\"table:users\"`\n\tName  string `json:\"name\"`\n\tEmail string `json:\"email\"`\n}\n\nfunc main() {\n\tdb, err := mongodb.NewMongodbAdapter(\u0026mongodb.Config{\n\t\tDatabaseName: \"database\",\n\t\tDatabaseUri:  \"mongodb://localhost:27017\",\n\t})\n\tdefer db.Disconnect()\n\tif err != nil {\n\t\tlog.Fatalf(\"error to connect: %v\", err)\n\t}\n\t\n\t// Insert model in table\n\tif _, err := db.NewInsert().Model(Model{\n\t\tName:  \"Lucas Bernardo\",\n\t\tEmail: \"example@gmail.com\",\n\t}).Exec(context.Background()); err != nil {\n\t\tlog.Fatalf(\"error to execute: %v\", err)\n\t}\n\tvar model Model\n\t// Find and return in model\n\tif err := db.NewFind().Model(\u0026model).Condition(\"name\", \"Lucas Bernardo\").Exec(context.Background()); err != nil {\n\t\tlog.Fatalf(\"error to find %v\", err)\n\t}\n\tfmt.Println(model)\n\n\tvar modelList = []Model{}\n\t// Find list in model\n\tif err := db.NewSelect().Model(\u0026modelList).Condition(\"name\", \"Lucas Bernardo\").Exec(context.Background()); err != nil {\n\t\tlog.Fatalf(\"error in select %v\", err)\n\t}\n\tfmt.Println(modelList)\n\n\t// Update value in table, '.Set(name string, value string)' set values updated \n\tif err := db.NewUpdate().Model(\u0026Model{}).Set(\"name\", \"Bernardinho\").Condition(\"name\", \"Lucas Bernardo\").Exec(context.Background()); err != nil {\n\t\tlog.Fatalf(\"error in update %v\", err)\n\t}\n\n\t// Delete value in table\n\tif err := db.NewDelete().Model(\u0026Model{}).Condition(\"name\", \"Bernardinho\").Exec(context.Background()); err != nil {\n\t\tlog.Fatalf(\"error decode %v\", err)\n\t}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flbernardo%2Fgo-database-odm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flbernardo%2Fgo-database-odm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flbernardo%2Fgo-database-odm/lists"}