{"id":37095006,"url":"https://github.com/goapt/scan","last_synced_at":"2026-01-14T11:42:59.783Z","repository":{"id":330239516,"uuid":"897163736","full_name":"goapt/scan","owner":"goapt","description":"Tiny lib to scan SQL rows directly to structs, slices, and primitive types","archived":false,"fork":false,"pushed_at":"2025-12-24T10:39:08.000Z","size":4073,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-25T17:06:44.454Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"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/goapt.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-02T06:30:11.000Z","updated_at":"2025-12-24T10:35:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/goapt/scan","commit_stats":null,"previous_names":["goapt/scan"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/goapt/scan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goapt%2Fscan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goapt%2Fscan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goapt%2Fscan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goapt%2Fscan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goapt","download_url":"https://codeload.github.com/goapt/scan/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goapt%2Fscan/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"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":[],"created_at":"2026-01-14T11:42:59.235Z","updated_at":"2026-01-14T11:42:59.770Z","avatar_url":"https://github.com/goapt.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scan\n\n[![GoDoc](https://godoc.org/github.com/goapt/scan?status.svg)](https://godoc.org/github.com/goapt/scan)\n[![Build Status](https://github.com/goapt/scan/workflows/go%20test/badge.svg)](https://github.com/goapt/scan/actions)\n[![Coverage Status](https://coveralls.io/repos/github/goapt/scan/badge.svg?branch=master)](https://coveralls.io/github/goapt/scan?branch=master)\n\nScan is a Go package for scanning database rows into structs or slices of primitive types.\n\n\u003e This project is forked from [https://github.com/blockloop/scan](https://github.com/blockloop/scan) and adjusted to be generic, while all dependencies are removed.\n\n## Installation\n\n```sh\ngo get github.com/goapt/scan\n```\n\n## Usage\n\n```go\nimport \"github.com/goapt/scan\"\n```\n\n## Examples\n\n### Multiple Rows\n\n```go\ntype Person struct {\n    ID   int    `db:\"id\"`\n    Name string\n}\n\ndb, err := sql.Open(\"sqlite3\", \"database.sqlite\")\nrows, err := db.Query(\"SELECT * FROM persons\")\ndefer rows.Close()\npersons, err := scan.Rows[Person](rows)\n\nfmt.Printf(\"%#v\", persons)\n// []Person{\n//    {ID: 1, Name: \"brett\"},\n//    {ID: 2, Name: \"fred\"},\n//    {ID: 3, Name: \"stacy\"},\n// }\n```\n\n### Multiple rows of primitive type\n\n```go\nrows, err := db.Query(\"SELECT name FROM persons\")\ndefer rows.Close()\nnames, err := scan.Rows[string](rows)\n\nfmt.Printf(\"%#v\", names)\n// []string{\n//    \"brett\",\n//    \"fred\",\n//    \"stacy\",\n// }\n```\n\n### Single row\n\n```go\nrows, err := db.Query(\"SELECT * FROM persons where name = 'brett' LIMIT 1\")\nperson, err := scan.Row[Person](rows)\ndefer rows.Close()\n\nfmt.Printf(\"%#v\", person)\n// Person{ ID: 1, Name: \"brett\" }\n```\n\n### Scalar value\n\n```go\nrows, err := db.Query(\"SELECT age FROM persons where name = 'brett' LIMIT 1\")\ndefer rows.Close()\nage, err := scan.Row[int8](rows)\n\nfmt.Printf(\"%d\", age)\n// 100\n```\n\n### Custom Column Mapping\n\nBy default, column names are mapped to and from database column names using basic title case conversion. You can override this behavior by setting `ScannerMapper` to custom functions.\n\n```go\nscan.ScannerMapper = func(columnName string) string {\n\treturn strings.ToLower(columnName)\n}\n```\n\n## Why\n\nWhile many other projects support similar features (i.e. [sqlx](https://github.com/jmoiron/sqlx)) scan allows you to use any database lib such as the stdlib to write fluent SQL statements and pass the resulting `rows` to `scan` for scanning.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoapt%2Fscan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoapt%2Fscan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoapt%2Fscan/lists"}