Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session.NewManager second params shoube be a object not a string #2096

Merged
merged 1 commit into from
Aug 16, 2016

Conversation

markismark
Copy link
Contributor

No description provided.

@astaxie
Copy link
Member

astaxie commented Aug 13, 2016

What's the benefit from the Object? If change it will broken the compatibility. If we have a great benefit from this change I will would love to do that. If not I would keep the same API now. What's your opinion?

@markismark
Copy link
Contributor Author

用英文解释起来比较费劲

  1. 传入string,开发者需要查看相关代码文件,了解config结构,自己手动拼接json。而如果是object,直接就可以通过代码提示,就可以快速的进行设置。这就像提供API一样,隐藏内部细节,向外暴漏参数就可以。
  2. 我个人猜测,大部分用户应该还是很少使用sessionConfig这个配置key吧,增删改都十分的不方便,如果遇见需要转义的字符,会跪的。不如使用多个key来配置方便。甚至我觉得都不需要提供这个sessionConfig选项
  3. 如果以后更改配置的config的默认值,需要在两个地方更改。如果不提供这个sessionConfig这个配置项,只有一个入口位置,就简单了很多。
  4. 之前的方式很奇怪,先把一个object->map->json->object,而我这种方式 就是object->object,就简单了很多
  5. managerConfig结构是private,但是里面的属性却是public,这是极其不合理的

@astaxie astaxie merged commit 7813cb5 into beego:develop Aug 16, 2016
@roxanebellot
Copy link

Indeed the compatibility is broken. Could you explain how are we supposed to use this new version of NewManager ? I can't figure it out 😕
(and just a reminder, the docs still recommand the old version)

@astaxie
Copy link
Member

astaxie commented Aug 22, 2016

@roxanebellot how did you use the session manage now? I am really sorry about that broken the compatibility. I will update the docs soon.

@BPing
Copy link

BPing commented Feb 10, 2017

为啥不保留两个接口呢?以便兼顾兼容性呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants