{"id":35140397,"url":"https://github.com/deadblue/sqlfunc","last_synced_at":"2026-04-28T19:02:07.871Z","repository":{"id":312058701,"uuid":"1045366075","full_name":"deadblue/sqlfunc","owner":"deadblue","description":"A SQL framework for Golang.","archived":false,"fork":false,"pushed_at":"2025-10-17T07:40:45.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-30T18:15:24.124Z","etag":null,"topics":["database","golang"],"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/deadblue.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":"2025-08-27T03:51:09.000Z","updated_at":"2025-10-17T07:34:22.000Z","dependencies_parsed_at":"2025-08-28T15:40:47.928Z","dependency_job_id":"2ab8e746-e113-4698-8bc5-9d2ca12e19fa","html_url":"https://github.com/deadblue/sqlfunc","commit_stats":null,"previous_names":["deadblue/sqlfunc"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/deadblue/sqlfunc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadblue%2Fsqlfunc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadblue%2Fsqlfunc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadblue%2Fsqlfunc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadblue%2Fsqlfunc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deadblue","download_url":"https://codeload.github.com/deadblue/sqlfunc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadblue%2Fsqlfunc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32394478,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: 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":["database","golang"],"created_at":"2025-12-28T11:07:34.005Z","updated_at":"2026-04-28T19:02:07.865Z","avatar_url":"https://github.com/deadblue.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL-Function\n\nRun your SQL as function.\n\n## Example\n\n```golang\nimport (\n\t\"context\"\n\t\"database/sql\"\n\t\"log\"\n\n\t\"github.com/deadblue/sqlfunc\"\n)\n\ntype (\n\tQueryParams struct {\n\t\tUserId string\n\t\tStatus int\n\t}\n\n\tUserResult struct {\n\t\tUserId    string\n\t\tFirstName string\n\t\t// sql.NullXXX types are supported.\n\t\tLastName sql.NullString\n\t\t// Mapping \"sex\" column to [Gender] field.\n\t\tGender int `sql:\"sex\"`\n\t}\n)\n\nfunc main() {\n\t// Make SQL function\n\tqueryUser, err := sqlfunc.MakeQueryFunc[QueryParams, UserResult](\n\t\t\"SELECT user_id, first_name, last_name, sex\",\n\t\t\"FROM tbl_user\",\n\t\t\"WHERE user_id = {{ .UserID }} AND status = {{ .Status }}\",\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Connect to database\n\tdb, err := sql.Open(\"driver\", \"DSN\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Put DB to context\n\tctx := sqlfunc.NewContext(context.TODO(), db)\n\n\t// Execute query\n\tresult, err := queryUser(ctx, QueryParams{\n\t\tUserId: \"123\",\n\t\tStatus: 1,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Process result\n\tif result.Valid {\n\t\tuser := result.V\n\t\tif user.LastName.Valid {\n\t\t\tlog.Printf(\"Found user: %s-%s\", user.FirstName, user.LastName.String)\n\t\t} else {\n\t\t\tlog.Printf(\"Found user: %s\", user.FirstName)\n\t\t}\n\t}\n}\n```\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadblue%2Fsqlfunc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeadblue%2Fsqlfunc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadblue%2Fsqlfunc/lists"}