package
0.0.0-20231103123238-49bf83314d38
Repository: https://github.com/daz-3ux/dblog.git
Documentation: pkg.go.dev
# README
store layer
- 仓库层
开发流程
使用单例工厂模式
- 创建一个结构体: 用来创建 store 层实例
- store 建立在
*gorm.DB
之上
- store 建立在
- 创建一个 New 函数: 初始化 store 层实例
- 创建一个包级别的 store 层变量: 为了方便调用 store 层实例
S *datastore
- 创建一个 sync.Once 变量: 为了避免实例被多次创建,
once sync.Once
设计思想
# Functions
NewMockAIStore creates a new mock instance.
NewMockIStore creates a new mock instance.
NewMockPostStore creates a new mock instance.
NewMockUserStore creates a new mock instance.
NewStore create an instance of type IStore.
# Variables
S global variable used for easy access to the initialized instance of store layer by other packages.
# Structs
MockAIStore is a mock of AIStore interface.
MockAIStoreMockRecorder is the mock recorder for MockAIStore.
MockIStore is a mock of IStore interface.
MockIStoreMockRecorder is the mock recorder for MockIStore.
MockPostStore is a mock of PostStore interface.
MockPostStoreMockRecorder is the mock recorder for MockPostStore.
MockUserStore is a mock of UserStore interface.
MockUserStoreMockRecorder is the mock recorder for MockUserStore.
# Interfaces
No description provided by the author
IStore defines the methods that need to be implemented by the Store layer such as IStore defines Users, Users defines the specific methods.
PostStore defines the methods that need to be implemented by the post model in the store layer.
UserStore defines the methods that need to be implemented by the user model in the store layer.