{"id":23107046,"url":"https://github.com/ganl/go-dm","last_synced_at":"2025-07-04T05:05:46.024Z","repository":{"id":99433323,"uuid":"608204048","full_name":"ganl/go-dm","owner":"ganl","description":"达梦 Go 驱动源码  针对版本 DM8","archived":false,"fork":false,"pushed_at":"2023-03-21T15:29:42.000Z","size":484,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T10:30:59.105Z","etag":null,"topics":["dm","dm8","drivers","golang","sql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ganl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"security/zy.go","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-01T14:35:41.000Z","updated_at":"2024-06-25T06:16:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"c22133d8-c6cb-4669-b633-62b2c2f3e93a","html_url":"https://github.com/ganl/go-dm","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"44b218f77c5e3b6bd3d331ac87612c5935dd36ab"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganl%2Fgo-dm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganl%2Fgo-dm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganl%2Fgo-dm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganl%2Fgo-dm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ganl","download_url":"https://codeload.github.com/ganl/go-dm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247092374,"owners_count":20882217,"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","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":["dm","dm8","drivers","golang","sql"],"created_at":"2024-12-17T01:12:09.302Z","updated_at":"2025-04-03T22:42:36.291Z","avatar_url":"https://github.com/ganl.png","language":"Go","readme":"# go-dm\n达梦官方 Go 驱动源码 \n\nDM 8.0+\n\nGo 1.13+\n\n源码来源于官方安装包，驱动包的路径： `dmdbms/drivers/go/dm-go-driver.zip`  , 详见说明： [Go 数据库接口](https://eco.dameng.com/document/dm/zh-cn/app-dev/go-go.html) \n\n## DataSourceName\n\n```\n\tdm://username:password@host:port?schema=schemaName[\u0026logLevel=debug\u0026sslFilesPath\u0026=pathValue\u0026timeout=timeoutValue\u0026param1=value1\u0026...\u0026paramN=valueN]\n```\n\n`dm://SYSDBA:SYSDBA@localhost:5236`\n\n## Example\n\n`go get github.com/ganl/go-dm@v1.2.193`\n\nPS: 8.1.2.192 / 8.2.2.192 官方未改驱动构建32位，编译报错： constant 4294967295 overflows int\n\n```golang\npackage main\n\nimport (\n\t\"database/sql\"\n\t_ \"github.com/ganl/go-dm\"\n\t\"log\"\n)\n\nfunc main() {\n\t//url := \"dm://\" + os.Getenv(\"dm_username\") + \":\" + os.Getenv(\"dm_password\") + \"@\" + os.Getenv(\"dm_host\") + \"?noConvertToHex=true\"\n\tconn, err := sql.Open(\"dm\", \"dm://SYSDBA:SYSDBA@192.168.100.168:7777\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\tdefer conn.Close()\n\tfor _, sqlstr := range []string{\n\t\t\"DROP TABLE IF EXISTS tmp_testabc\",\n\t\t`CREATE TABLE  tmp_testabc (\n\t\t\tid bigint primary key,\n\t\t\tname varchar(12)\n\t\t)`,\n\t} {\n\t\t_, err := conn.Exec(sqlstr)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t\treturn\n\t\t}\n\t}\n\tvar id int64\n\tsqlstr := \"insert into tmp_testabc(id, name) values(1, 'a') returning id into :id\"\n\t_, err = conn.Exec(sqlstr, sql.Out{Dest: \u0026id})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\tif id != 1{\n\t\tlog.Fatal(\"Error cmp\")\n\t}\n\tsqlstr = \"insert into tmp_testabc(id, name) values(2, 'b') returning id into :id\"\n\t_, err = conn.Exec(sqlstr, sql.Named(\"id123\", sql.Out{Dest: \u0026id}))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\tif id != 2{\n\t\tlog.Fatal(\"Error cmp\")\n\t}\n}\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganl%2Fgo-dm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fganl%2Fgo-dm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganl%2Fgo-dm/lists"}