{"id":20986625,"url":"https://github.com/dpwgc/easy-go-redis","last_synced_at":"2026-04-28T13:01:24.324Z","repository":{"id":144344881,"uuid":"460818493","full_name":"dpwgc/easy-go-redis","owner":"dpwgc","description":"一个简易的Redis Golang客户端","archived":false,"fork":false,"pushed_at":"2022-02-18T11:10:07.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T11:25:53.372Z","etag":null,"topics":["client","go","golang","redis","tcp"],"latest_commit_sha":null,"homepage":"https://gitee.com/dpwgc/easy-go-redis","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/dpwgc.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-18T11:02:37.000Z","updated_at":"2022-02-18T11:09:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"9de87854-f2aa-462b-adcf-84a419424a57","html_url":"https://github.com/dpwgc/easy-go-redis","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dpwgc/easy-go-redis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Feasy-go-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Feasy-go-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Feasy-go-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Feasy-go-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dpwgc","download_url":"https://codeload.github.com/dpwgc/easy-go-redis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Feasy-go-redis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32381696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["client","go","golang","redis","tcp"],"created_at":"2024-11-19T06:14:23.152Z","updated_at":"2026-04-28T13:01:24.304Z","avatar_url":"https://github.com/dpwgc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# easy-go-redis\n\n## 一个简易的Redis Golang客户端\n\n***\n\n### 导入客户端\n\n* 引入包：`go get github.com/dpwgc/easy-go-redis`\n\n***\n\n### 函数说明\n\n#### cli/opt.go\n\n##### Conn\n\n```\n// Conn 与redis建立连接\nfunc Conn(addr string,port string) (*net.TCPConn,error)\n\naddr: Redis服务器的IP地址\nport: Redis的服务端口号\nreturn: TCP连接及报错信息\n```\n\n##### Do\n\n```\n// Do 执行命令\nfunc Do(conn *net.TCPConn,arr ...string) (string,error)\n\nconn: TCP连接\narr: 命令关键字切片\nreturn: 命令执行后服务器的反馈信息及报错信息\n```\n\n##### Close\n\n```\n// Close 关闭连接\nfunc Close(conn *net.TCPConn) error\n\nconn: TCP连接\nreturn: 报错信息\n```\n\n##### Analytic\n\n```\n// Analytic 解析Redis返回的数据（将RESP的数据格式转为string字符串）\nfunc Analytic(data string) []string\n\ndata: 命令执行后服务器的反馈信息\nreturn: 解析后的反馈信息数组\n```\n\n***\n\n### 使用示范\n\n```go\nimport (\n    \"fmt\"\n    \"github.com/dpwgc/easy-go-redis/cli\"\n    \"strconv\"\n)\n\nfunc test()  {\n\n\t//与redis建立连接\n\tconn,err := cli.Conn(\"127.0.0.1\",\"6379\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t\n\t\n\n\t//输入密码\n\tres,err := cli.Do(conn,\"auth\",\"123456\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//解析并输出服务端的反馈信息\n\tfmt.Println(cli.Analytic(res))\n\t\n\t\n\n\t//插入一条key为\"test\"，value为\"hello world\"的string类型数据\n\tres,err = cli.Do(conn,\"set\",\"test\",\"hello world\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//解析并输出服务端的反馈信息\n\tfmt.Println(cli.Analytic(res))\n\t\n\t\n\n\t//获取key为\"test\"的value\n\tres,err = cli.Do(conn,\"get\",\"test\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//解析并输出服务端的反馈信息\n\tfmt.Println(cli.Analytic(res))\n\t\n\t\n\n\t//循环往list中添加数据\n\tfor i:=0;i\u003c3;i++ {\n\t\tdata := \"hi-\" + strconv.Itoa(i) //\"hi-1\",\"hi-2\",\"hi-3\"\n\t\tres,err = cli.Do(conn,\"lpush\",\"test_list\",data)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\t//解析并输出服务端的反馈信息\n\t\tfmt.Println(cli.Analytic(res))\n\t}\n\t\n\t\n\n\t//读取列表中指定区间的元素\n\tres,err = cli.Do(conn,\"lrange\",\"test_list\",\"0\",\"10\")\n\t//解析并输出服务端的反馈信息\n\tfmt.Println(cli.Analytic(res))\n\t\n\t\n\n\t//关闭连接\n\terr = cli.Close(conn)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpwgc%2Feasy-go-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdpwgc%2Feasy-go-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpwgc%2Feasy-go-redis/lists"}