store

package
v0.0.0-...-d32eb86 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClient

func SetClient(factory Factory)

SetClient is a function for setting the package-level client variable. It is used to initialize the client with a concrete implementation of Factory.

Types

type Factory

type Factory interface {
	Users() UserStore // Users returns an instance of UserStore for user-related data operations.
	Close() error     // Close is responsible for closing any resources used by the factory, e.g., database connections.
}

Factory is an interface that abstracts the creation of different stores. It provides methods to access different data stores and to close them.

func Client

func Client() Factory

Client is a function that returns the current instance of Factory.

type MockFactory

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

func NewMockFactory

func NewMockFactory(ctrl *gomock.Controller) *MockFactory

func (*MockFactory) Close

func (m *MockFactory) Close() error

func (*MockFactory) EXPECT

func (m *MockFactory) EXPECT() *MockFactoryMockRecorder

func (*MockFactory) Users

func (m *MockFactory) Users() UserStore

type MockFactoryMockRecorder

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

func (*MockFactoryMockRecorder) Close

func (mr *MockFactoryMockRecorder) Close() *gomock.Call

func (*MockFactoryMockRecorder) Users

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

type MockUserStore

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

func NewMockUserStore

func NewMockUserStore(ctrl *gomock.Controller) *MockUserStore

func (*MockUserStore) Create

func (m *MockUserStore) Create(arg0 context.Context, arg1 *model.User, arg2 model.CreateOptions) error

func (*MockUserStore) Delete

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

func (*MockUserStore) DeleteCollection

func (m *MockUserStore) DeleteCollection(arg0 context.Context, arg1 []string, arg2 model.DeleteOptions) error

func (*MockUserStore) EXPECT

func (*MockUserStore) Get

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

func (*MockUserStore) List

func (*MockUserStore) Update

func (m *MockUserStore) Update(arg0 context.Context, arg1 *model.User, arg2 model.UpdateOptions) error

type MockUserStoreMockRecorder

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

func (*MockUserStoreMockRecorder) Create

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

func (*MockUserStoreMockRecorder) Delete

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

func (*MockUserStoreMockRecorder) DeleteCollection

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

func (*MockUserStoreMockRecorder) Get

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

func (*MockUserStoreMockRecorder) List

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

func (*MockUserStoreMockRecorder) Update

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

type UserStore

type UserStore interface {
	Create(ctx context.Context, user *model.User, opts model.CreateOptions) error
	Update(ctx context.Context, user *model.User, opts model.UpdateOptions) error
	Delete(ctx context.Context, userId uint64, opts model.DeleteOptions) error
	// DeleteCollection(ctx context.Context, userId []uint64, opts model.DeleteOptions) error
	Get(ctx context.Context, userId uint64, opts model.GetOptions) (*model.User, error)
	GetByUsername(ctx context.Context, username string, opts model.GetOptions) (*model.User, error)
	List(ctx context.Context, opts model.ListOptions) (*model.UserList, error)
}

UserStore defines the user storage interface.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
user_grpc_service.go
user_grpc_service.go

Jump to

Keyboard shortcuts

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