{"id":34612254,"url":"https://github.com/jensteichert/colt","last_synced_at":"2025-12-24T14:17:04.330Z","repository":{"id":56854757,"uuid":"524707024","full_name":"jensteichert/colt","owner":"jensteichert","description":"A productive and type-safe MongoDB ODM for Go. Based on the official MongoDB driver but elegant to use.","archived":false,"fork":false,"pushed_at":"2025-03-03T19:33:34.000Z","size":101,"stargazers_count":46,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-03T20:32:24.338Z","etag":null,"topics":["database","generics","go","golang","mongodb","mongodb-driver","mongoose","odm"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/jensteichert/colt","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/jensteichert.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,"publiccode":null,"codemeta":null}},"created_at":"2022-08-14T15:20:33.000Z","updated_at":"2025-03-03T19:33:31.000Z","dependencies_parsed_at":"2023-02-16T16:16:00.647Z","dependency_job_id":"3e91f887-4759-443e-9a60-abfd64aa57ae","html_url":"https://github.com/jensteichert/colt","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/jensteichert/colt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensteichert%2Fcolt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensteichert%2Fcolt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensteichert%2Fcolt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensteichert%2Fcolt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jensteichert","download_url":"https://codeload.github.com/jensteichert/colt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensteichert%2Fcolt/sbom","scorecard":{"id":515166,"data":{"date":"2025-08-11","repo":{"name":"github.com/jensteichert/colt","commit":"00b7803dafc7902b511d3bfdc7ccbb566af10ff8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":2,"reason":"Found 2/9 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/jensteichert/colt/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/jensteichert/colt/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/jensteichert/colt/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/jensteichert/colt/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/jensteichert/colt/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/jensteichert/colt/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/jensteichert/colt/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/jensteichert/colt/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/jensteichert/colt/codeql.yml/main?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/codeql.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T01:37:04.109Z","repository_id":56854757,"created_at":"2025-08-20T01:37:04.109Z","updated_at":"2025-08-20T01:37:04.109Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28003726,"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","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"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","generics","go","golang","mongodb","mongodb-driver","mongoose","odm"],"created_at":"2025-12-24T14:17:04.271Z","updated_at":"2025-12-24T14:17:04.325Z","avatar_url":"https://github.com/jensteichert.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Colt\n\n![Build \u0026 Tests](https://github.com/jensteichert/webvitals_exporter/workflows/Build/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/jensteichert/colt/badge.svg?branch=main)](https://coveralls.io/github/jensteichert/colt?branch=main)\n[![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-blue?logo=go\u0026logoColor=white)](https://pkg.go.dev/github.com/jensteichert/colt)\n![CodeQL](https://github.com/jensteichert/colt/workflows/CodeQL/badge.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/jensteichert/colt)](https://goreportcard.com/report/github.com/jensteichert/colt)\n\u003ca href=\"https://github.com/jensteichert/colt/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/jensteichert/colt\" /\u003e\u003c/a\u003e\n\nThe [MongoDB](https://www.mongodb.com) ODM for [Go](https://go.dev) i've always wanted. Inspired by [Mongoose](https://github.com/Automattic/mongoose).\n\nColt wraps the official [mongo-go-driver](https://github.com/mongodb/mongo-go-driver).\n\n### Requirements\n- [Go 1.18](https://tip.golang.org/doc/go1.18) or higher. Colt leverages Generics to provide type-safe methods and decoding of documents.\n\n### Installation\nTo install Colt, use `go get`:\n```\ngo get github.com/jensteichert/colt\n```\n\n### Quick Start\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/jensteichert/colt\"\n\t\"go.mongodb.org/mongo-driver/bson\"\n)\n\ntype Database struct {\n\tTodos *colt.Collection[*Todo]\n}\n\ntype Todo struct {\n\tcolt.DocWithTimestamps `bson:\",inline\"`\n\tTitle string `bson:\"title\" json:\"title\"`\n}\n\nfunc main() {\n\tdb := colt.Database{}\n\tdb.Connect(\"mongodb://...\", \"myDatabaseName\")\n\n\tdatabase := Database{\n\t\tTodos: colt.GetCollection[*Todo](\u0026db, \"todos\"),\n\t}\n\n\tnewTodo := Todo{Title: \"Hello\"}\n\n\ttodo, _ := database.Todos.Insert(\u0026newTodo) // Will return a Todo\n\tinsertedTodo, _ := database.Todos.FindById(todo.ID)\n\n\tallTodos, _ := database.Todos.Find(bson.M{\"title\": \"Hello\"})\n}\n```\n\n## Features\n\n### Hooks\n\n#### ``BeforeInsert`` Hook\nTriggers before a document will be inserted\n```golang\ntype Todo struct {\n\tcolt.DocWithTimestamps `bson:\",inline\"`\n}\n\nfunc(t *Todo) BeforeInsert() error {\n\tt.DocWithTimestamps.BeforeInsert()\n\n        // Do something with t here\n\treturn nil\n}\n```\n\n#### ``BeforeUpdate`` Hook\nTriggers before a document will be updated\n```golang\nfunc(t *Todo) BeforeUpdate() error {\n\tt.DocWithTimestamps.BeforeUpdate()\n\n        // Do something with t here\n\treturn nil\n}\n```\n\n#### ``NewID`` Hook\nCan be used to generate custom ids for documents within a collection\n```golang\nfunc (t *Todo) NewID() string {\n    return \"td_\" + primitive.NewObjectID().Hex()\n}\n```\n\n### ToDo\n- [x] CRUD\n- [x] Hooks\n- [x] Disconnect\n- [ ] Context\n- [ ] Transactions\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjensteichert%2Fcolt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjensteichert%2Fcolt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjensteichert%2Fcolt/lists"}