store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package store is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewStore, wire.Bind(new(IStore), new(*datastore)))

ProviderSet is a Wire provider set that initializes new datastore instances and binds the IStore interface to the actual datastore type.

View Source
var (
	S *datastore
)

Singleton instance variables.

View Source
var (
	SetterProviderSet = wire.NewSet(NewSecretSetter, wire.Bind(new(auth.TemporarySecretSetter), new(*secretSetter)))
)

Functions

func NewSecretSetter

func NewSecretSetter(ds *datastore) *secretSetter

NewSecretSetter initializes a new secretSetter instance using the provided datastore.

func NewStore

func NewStore(db *gorm.DB) *datastore

NewStore initializes a new datastore instance using the provided DB gorm instance. It also creates a singleton instance for the datastore.

Types

type IStore

type IStore interface {
	TX(context.Context, func(ctx context.Context) error) error
	Users() UserStore
	Secrets() SecretStore
}

IStore is an interface that represents methods required to be implemented by a Store implementation.

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) EXPECT

func (m *MockIStore) EXPECT() *MockIStoreMockRecorder

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

func (*MockIStore) Secrets

func (m *MockIStore) Secrets() SecretStore

Secrets mocks base method.

func (*MockIStore) TX

func (m *MockIStore) TX(arg0 context.Context, arg1 func(context.Context) error) error

TX 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) Secrets

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

Secrets indicates an expected call of Secrets.

func (*MockIStoreMockRecorder) TX

func (mr *MockIStoreMockRecorder) TX(arg0, arg1 interface{}) *gomock.Call

TX indicates an expected call of TX.

func (*MockIStoreMockRecorder) Users

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

Users indicates an expected call of Users.

type MockSecretStore

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

MockSecretStore is a mock of SecretStore interface.

func NewMockSecretStore

func NewMockSecretStore(ctrl *gomock.Controller) *MockSecretStore

NewMockSecretStore creates a new mock instance.

func (*MockSecretStore) Create

func (m *MockSecretStore) Create(arg0 context.Context, arg1 *model.SecretM) error

Create mocks base method.

func (*MockSecretStore) Delete

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

Delete mocks base method.

func (*MockSecretStore) EXPECT

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

func (*MockSecretStore) Get

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

Get mocks base method.

func (*MockSecretStore) List

func (m *MockSecretStore) List(arg0 context.Context, arg1 string, arg2 ...meta.ListOption) (int64, []*model.SecretM, error)

List mocks base method.

func (*MockSecretStore) Update

func (m *MockSecretStore) Update(arg0 context.Context, arg1 *model.SecretM) error

Update mocks base method.

type MockSecretStoreMockRecorder

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

MockSecretStoreMockRecorder is the mock recorder for MockSecretStore.

func (*MockSecretStoreMockRecorder) Create

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

Create indicates an expected call of Create.

func (*MockSecretStoreMockRecorder) Delete

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

Delete indicates an expected call of Delete.

func (*MockSecretStoreMockRecorder) Get

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

Get indicates an expected call of Get.

func (*MockSecretStoreMockRecorder) List

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

List indicates an expected call of List.

func (*MockSecretStoreMockRecorder) Update

func (mr *MockSecretStoreMockRecorder) 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 map[string]interface{}) error

Delete mocks base method.

func (*MockUserStore) EXPECT

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

func (*MockUserStore) Fetch

func (m *MockUserStore) Fetch(arg0 context.Context, arg1 map[string]interface{}) (*model.UserM, error)

Fetch mocks base method.

func (*MockUserStore) Get

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

Get mocks base method.

func (*MockUserStore) GetByUsername

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

GetByUsername mocks base method.

func (*MockUserStore) List

func (m *MockUserStore) List(arg0 context.Context, arg1 ...meta.ListOption) (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) Fetch

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

Fetch indicates an expected call of Fetch.

func (*MockUserStoreMockRecorder) Get

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

Get indicates an expected call of Get.

func (*MockUserStoreMockRecorder) GetByUsername

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

GetByUsername indicates an expected call of GetByUsername.

func (*MockUserStoreMockRecorder) List

func (mr *MockUserStoreMockRecorder) List(arg0 interface{}, arg1 ...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 SecretStore

type SecretStore interface {
	Create(ctx context.Context, secret *model.SecretM) error
	Delete(ctx context.Context, userID string, name string) error
	Update(ctx context.Context, secret *model.SecretM) error
	Get(ctx context.Context, userID string, name string) (*model.SecretM, error)
	List(ctx context.Context, userID string, opts ...meta.ListOption) (int64, []*model.SecretM, error)
}

SecretStore defines the secret storage interface, containing methods for managing secret records in a datastore.

type UserStore

type UserStore interface {
	// Create adds a new user record to the database.
	Create(ctx context.Context, user *model.UserM) error
	// List returns a slice of user records based on the specified query conditions.
	List(ctx context.Context, opts ...meta.ListOption) (int64, []*model.UserM, error)
	// Get retrieves a user record by userID and username.
	Get(ctx context.Context, userID string, username string) (*model.UserM, error)
	// Update modifies an existing user record.
	Update(ctx context.Context, user *model.UserM) error
	// Delete removes a user record using the provided filters.
	Delete(ctx context.Context, filters map[string]interface{}) error

	// Extensions
	// Fetch retrieves a user record using provided filters.
	Fetch(ctx context.Context, filters map[string]interface{}) (*model.UserM, error)
	// GetByUsername retrieves a user record using username as the query condition.
	GetByUsername(ctx context.Context, username string) (*model.UserM, error)
}

UserStore defines the interface for managing user data storage.

Jump to

Keyboard shortcuts

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