store

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package store defines the storage interface for miniblog.

Package store is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (

	// 全局变量,方便其它包直接调用已初始化好的 S 实例.
	S *datastore
)

Functions

func NewStore

func NewStore(db *gorm.DB) *datastore

NewStore 创建一个 IStore 类型的实例.

Types

type IStore

type IStore interface {
	DB() *gorm.DB
	Users() UserStore
	Posts() PostStore
}

IStore 定义了 Store 层需要实现的方法.

type MockIStore

type MockIStore struct {
	// contains filtered or unexported fields
}

MockIStore is a mock of IStore interface.

func NewMockIStore

func NewMockIStore(ctrl *gomock.Controller) *MockIStore

NewMockIStore creates a new mock instance.

func (*MockIStore) DB

func (m *MockIStore) DB() *gorm.DB

DB mocks base method.

func (*MockIStore) EXPECT

func (m *MockIStore) EXPECT() *MockIStoreMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIStore) Posts

func (m *MockIStore) Posts() PostStore

Posts mocks base method.

func (*MockIStore) Users

func (m *MockIStore) Users() UserStore

Users mocks base method.

type MockIStoreMockRecorder

type MockIStoreMockRecorder struct {
	// contains filtered or unexported fields
}

MockIStoreMockRecorder is the mock recorder for MockIStore.

func (*MockIStoreMockRecorder) DB

DB indicates an expected call of DB.

func (*MockIStoreMockRecorder) Posts

func (mr *MockIStoreMockRecorder) Posts() *gomock.Call

Posts indicates an expected call of Posts.

func (*MockIStoreMockRecorder) Users

func (mr *MockIStoreMockRecorder) Users() *gomock.Call

Users indicates an expected call of Users.

type MockPostStore

type MockPostStore struct {
	// contains filtered or unexported fields
}

MockPostStore is a mock of PostStore interface.

func NewMockPostStore

func NewMockPostStore(ctrl *gomock.Controller) *MockPostStore

NewMockPostStore creates a new mock instance.

func (*MockPostStore) Create

func (m *MockPostStore) Create(arg0 context.Context, arg1 *model.PostM) error

Create mocks base method.

func (*MockPostStore) Delete

func (m *MockPostStore) Delete(arg0 context.Context, arg1 string, arg2 []string) error

Delete mocks base method.

func (*MockPostStore) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPostStore) Get

func (m *MockPostStore) Get(arg0 context.Context, arg1, arg2 string) (*model.PostM, error)

Get mocks base method.

func (*MockPostStore) List

func (m *MockPostStore) List(arg0 context.Context, arg1 string, arg2, arg3 int) (int64, []*model.PostM, error)

List mocks base method.

func (*MockPostStore) Update

func (m *MockPostStore) Update(arg0 context.Context, arg1 *model.PostM) error

Update mocks base method.

type MockPostStoreMockRecorder

type MockPostStoreMockRecorder struct {
	// contains filtered or unexported fields
}

MockPostStoreMockRecorder is the mock recorder for MockPostStore.

func (*MockPostStoreMockRecorder) Create

func (mr *MockPostStoreMockRecorder) Create(arg0, arg1 interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockPostStoreMockRecorder) Delete

func (mr *MockPostStoreMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockPostStoreMockRecorder) Get

func (mr *MockPostStoreMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockPostStoreMockRecorder) List

func (mr *MockPostStoreMockRecorder) List(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

List indicates an expected call of List.

func (*MockPostStoreMockRecorder) Update

func (mr *MockPostStoreMockRecorder) Update(arg0, arg1 interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockUserStore

type MockUserStore struct {
	// contains filtered or unexported fields
}

MockUserStore is a mock of UserStore interface.

func NewMockUserStore

func NewMockUserStore(ctrl *gomock.Controller) *MockUserStore

NewMockUserStore creates a new mock instance.

func (*MockUserStore) Create

func (m *MockUserStore) Create(arg0 context.Context, arg1 *model.UserM) error

Create mocks base method.

func (*MockUserStore) Delete

func (m *MockUserStore) Delete(arg0 context.Context, arg1 string) error

Delete mocks base method.

func (*MockUserStore) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockUserStore) Get

func (m *MockUserStore) Get(arg0 context.Context, arg1 string) (*model.UserM, error)

Get mocks base method.

func (*MockUserStore) List

func (m *MockUserStore) List(arg0 context.Context, arg1, arg2 int) (int64, []*model.UserM, error)

List mocks base method.

func (*MockUserStore) Update

func (m *MockUserStore) Update(arg0 context.Context, arg1 *model.UserM) error

Update mocks base method.

type MockUserStoreMockRecorder

type MockUserStoreMockRecorder struct {
	// contains filtered or unexported fields
}

MockUserStoreMockRecorder is the mock recorder for MockUserStore.

func (*MockUserStoreMockRecorder) Create

func (mr *MockUserStoreMockRecorder) Create(arg0, arg1 interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockUserStoreMockRecorder) Delete

func (mr *MockUserStoreMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockUserStoreMockRecorder) Get

func (mr *MockUserStoreMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockUserStoreMockRecorder) List

func (mr *MockUserStoreMockRecorder) List(arg0, arg1, arg2 interface{}) *gomock.Call

List indicates an expected call of List.

func (*MockUserStoreMockRecorder) Update

func (mr *MockUserStoreMockRecorder) Update(arg0, arg1 interface{}) *gomock.Call

Update indicates an expected call of Update.

type PostStore

type PostStore interface {
	Create(ctx context.Context, post *model.PostM) error
	Get(ctx context.Context, username, postID string) (*model.PostM, error)
	Update(ctx context.Context, post *model.PostM) error
	List(ctx context.Context, username string, offset, limit int) (int64, []*model.PostM, error)
	Delete(ctx context.Context, username string, postIDs []string) error
}

PostStore 定义了 post 模块在 store 层所实现的方法.

type UserStore

type UserStore interface {
	Create(ctx context.Context, user *model.UserM) error
	Get(ctx context.Context, username string) (*model.UserM, error)
	Update(ctx context.Context, user *model.UserM) error
	List(ctx context.Context, offset, limit int) (int64, []*model.UserM, error)
	Delete(ctx context.Context, username string) error
}

UserStore 定义了 user 模块在 store 层所实现的方法.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL