{"id":23682899,"url":"https://github.com/johejo/dbtypegen","last_synced_at":"2026-04-29T09:36:55.658Z","repository":{"id":38184010,"uuid":"333106279","full_name":"johejo/dbtypegen","owner":"johejo","description":"dbtypegen is a tool that generates Go structures from a database schema.","archived":false,"fork":false,"pushed_at":"2022-08-13T19:49:28.000Z","size":88,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-21T21:08:09.322Z","etag":null,"topics":["code-generation","code-generator","database","ddl","generator","go","golang","schema","sql"],"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/johejo.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":"2021-01-26T14:14:49.000Z","updated_at":"2022-01-04T20:08:36.000Z","dependencies_parsed_at":"2022-08-08T23:16:57.510Z","dependency_job_id":null,"html_url":"https://github.com/johejo/dbtypegen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/johejo/dbtypegen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johejo%2Fdbtypegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johejo%2Fdbtypegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johejo%2Fdbtypegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johejo%2Fdbtypegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johejo","download_url":"https://codeload.github.com/johejo/dbtypegen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johejo%2Fdbtypegen/sbom","scorecard":{"id":527999,"data":{"date":"2025-08-11","repo":{"name":"github.com/johejo/dbtypegen","commit":"f99e6dba35e716c8dc6670f32c6de902a3d7aa1d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"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":"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":"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":"Code-Review","score":-1,"reason":"Found no human activity in the last 30 changesets","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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.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":"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/ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/johejo/dbtypegen/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/johejo/dbtypegen/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/johejo/dbtypegen/ci.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 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":"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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 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"}}]},"last_synced_at":"2025-08-20T04:57:15.841Z","repository_id":38184010,"created_at":"2025-08-20T04:57:15.841Z","updated_at":"2025-08-20T04:57:15.841Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32420350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["code-generation","code-generator","database","ddl","generator","go","golang","schema","sql"],"created_at":"2024-12-29T19:59:22.150Z","updated_at":"2026-04-29T09:36:55.633Z","avatar_url":"https://github.com/johejo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dbtypegen\n\n[![ci](https://github.com/johejo/dbtypegen/workflows/ci/badge.svg?branch=main)](https://github.com/johejo/dbtypegen/actions?query=workflow%3Aci)\n[![Go Reference](https://pkg.go.dev/badge/github.com/johejo/dbtypegen.svg)](https://pkg.go.dev/github.com/johejo/dbtypegen)\n[![codecov](https://codecov.io/gh/johejo/dbtypegen/branch/main/graph/badge.svg)](https://codecov.io/gh/johejo/dbtypegen)\n[![Go Report Card](https://goreportcard.com/badge/github.com/johejo/dbtypegen)](https://goreportcard.com/report/github.com/johejo/dbtypegen)\n\ndbtypegen is a tool that generates Go structures from a database schema.\n\n## Install\n\n```\ngo install github.com/johejo/dbtypegen/cmd/dbtypegen\n```\n\n## Usage\n\n```\nmkdir example\ncd example/\ngo mod init example\n```\n\nCreate schema DDL\n\n`schema.sql`\n\n```sql\nCREATE TABLE `user` (\n  id   BIGINT PRIMARY KEY,\n  created_at DATETIME(3) NOT NULL,\n  active BOOLEAN DEFAULT NULL,\n  name VARCHAR(36) NOT NULL\n);\n```\n\n```\ndbtypegen -schema schema.sql -out ./db_types_gen.go -package example\n```\n\nGenerated file\n\n```go\n// Code generated by dbtypegen, DO NOT EDIT.\n\npackage example\n\nimport (\n\t\"time\"\n)\n\n// User is the type that represents table `user`.\ntype User struct {\n\tId        int64     `db:\"id\"`\n\tCreatedAt time.Time `db:\"created_at\"`\n\tActive    bool      `db:\"active\"`\n\tName      string    `db:\"name\"`\n}\n\n// Columns returns all columns as joined string\nfunc (t *User) Columns() string {\n\treturn \"id,created_at,active,name\"\n}\n\n// ColumnList returns all columns as slice of string.\nfunc (t *User) ColumnList() []string {\n\treturn []string{\"id\", \"created_at\", \"active\", \"name\"}\n}\n\n// TableName returns the name of table.\nfunc (t *User) TableName() string {\n\treturn \"user\"\n}\n\n// SelectAll returns a part of query like `SELECT id,name FROM people`.\nfunc (t *User) SelectAll() string {\n\treturn \"SELECT id,created_at,active,name FROM user\"\n}\n\n// ScanAll returns field's pointers for row.Scan.\nfunc (t *User) ScanAll() []interface{} {\n\treturn []interface{}{\u0026t.Id, \u0026t.CreatedAt, \u0026t.Active, \u0026t.Name}\n}\n```\n\nINSERT and SELECT\n\n```go\nvar u User\n\nvar b strings.Builder\nb.WriteString(\"INSERT INTO \")\nb.WriteString(u.TableName())\nb.WriteString(\" (\")\nb.WriteString(u.Columns())\nb.WriteString(\") \")\nb.WriteString(\"VALUES (?,?,?,?)\")\nq := b.String()\nnow := time.Now()\nargs := []interface{}{1, now, true, \"Gopher\"}\n\nif _, err := db.ExecContext(ctx, q, args...); err != nil {\n\tpanic(err)\n}\n\nif err := db.QueryRowContext(ctx, u.SelectAll()+\" WHERE id=?\", 1).Scan(u.ScanAll()...); err != nil {\n\tpanic(err)\n}\n\nfmt.Println(u)\n// {1 20xx-xx-xx xx:xx:xx.xxx +0000 UTC true Gopher}\n```\n\n## License\n\nMIT\n\n## Author\n\nMitsuo Heijo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohejo%2Fdbtypegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohejo%2Fdbtypegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohejo%2Fdbtypegen/lists"}