Comments (9)
@Devying 这样子使用: redis.StringMap(conn.Do("HGETALL", key))
from go-gin-example.
@eddycjy 我用的是ByteSlices
from go-gin-example.
@Devying HGETALL
具体使用什么方法转换,根据你的实际业务场景选用就行了
from go-gin-example.
@eddycjy 你的方法更简单一些,对了发现文档有点难理解,如果做redis别的操作有什么好的建议吗
from go-gin-example.
像这个方法redis.StringMap(conn.Do("HGETALL", key)) 文档上写的参数是两个,第二个是err。怎么没传呢
from go-gin-example.
@Devying Conn 方法的原型:
Do(commandName string, args ...interface{}) (reply interface{}, err error)
其实不难的,就是 1 + N 的模式,Do 方法是用于命令执行,其余像 StringMap 或 ByteSlices 都只是它针对不同的场景给你提供的便捷解析方法
你觉得文档难理解,首先我觉得是你没有理解它这个包的大概的设计思路。 建议理解包的设计思路,多想想它为什么要这么写 API,就觉得文档很简单了
from go-gin-example.
“做redis别的操作有什么好的建议吗”
实际开发,我们都是根据需要啥样子的值,调用什么解析方法的
from go-gin-example.
好的非常感谢
from go-gin-example.
@eddycjy 我刚认真看了一下文档,一下子豁然开朗,很清楚了,我准备用用看
from go-gin-example.
Related Issues (20)
- 自定义http返回码的用意 ?
- tags pagination bug
- runtime error: invalid memory address or nil pointer dereference HOT 1
- jwt签名内容包含了用户的密码,签名只可验证不能保密,会泄漏密码,只包含用户id就好了吧 HOT 2
- go get github.com/EDDYCJY/go-gin-example: invalid proxy URL missing scheme: direct;
- runtime error: invalid memory address or nil pointer dereference
- token怎么更新?
- 在swagger里如何使用token HOT 2
- 很多项目过期了api不能用了
- 能否简化,萌新看不太懂
- 这里应该是 !exists HOT 1
- sql: unknown driver "mysql" (forgotten import?) HOT 1
- Bug: auth api
- auth 404 HOT 1
- cors failed HOT 1
- Vulnerability of dependency "golang.org/x/net" HOT 1
- 获取token后怎么调用路由接口,postman测试url怎么填写
- token错误码
- 授权bug
- 用这套模板做公司入门考核的登录认证接口,结果被告知server的目录设计不合理,考核失败。
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-gin-example.