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

在 OlivOS 框架中内置插件的配置项数据库 #95

Merged
merged 8 commits into from
Sep 9, 2023

Conversation

raininboat
Copy link
Member

通过在 OlivOS 中添加一个统一的配置项数据库,一方面有助于更多轻量级插件直接存取配置信息方便开发;另一方面提供一个专门的 unity 命名空间,可以方便插件之间的配置互通。

主要特点和目标

  • 基于手动传入 namespace 进行变量命名空间管理,当 namespace 为当前插件自身名称时,存储的变量名称不用担心和其他插件的重名,可作为私有配置使用
  • 当 namespace 为统一常量 unity 时,存储的插件配置可以被所有插件共享。通过这个方式,可以更加方便的实现前置和后继插件业务逻辑分离。
  • 后续可以进行一定的倡议,将诸如用户权限固定为统一的配置项名称,这样不同的插件可以使用统一的权限管理,更加方便
  • 注意:这个数据库是设计为适合每次存取单个用户/群组的一个配置项,如在某个群聊中该插件是否打开的开关这里可以很方便的存取。但是如果是每次需要存取一大堆数据(比如抽卡记录、人物卡信息),虽然理论上可以通过存储为json等形式实现,但是建议还是插件自己独立实现存取过程。

目前还没有具体完成各个函数的设计和功能测试,先做成 draft 占个坑()

@raininboat raininboat mentioned this pull request Aug 13, 2023
3 tasks
@raininboat
Copy link
Member Author

raininboat commented Aug 13, 2023

差不多搞好了,先转成正式pr

230824:增加pkl参数(默认为 False),当设置为True时可以实现如字典、列表等容器类型的保存

@raininboat raininboat marked this pull request as ready for review August 13, 2023 20:15
@lunzhiPenxil lunzhiPenxil merged commit a5d6127 into OlivOS-Team:main Sep 9, 2023
@raininboat raininboat deleted the userconf branch September 9, 2023 13:37

}

def get_nammespace_hash(namespace:"str|None"):
Copy link
Member Author

@raininboat raininboat Sep 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

草,这个typo竟然没有看见,我有罪。。。。
因为ide补全,下文里面用到的3处地方也全都是这个typo

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.

2 participants