repository

package
v0.0.0-...-feccc8a Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package repository is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserNotFound defines the error if a user could not be found.
	ErrUserNotFound = errors.New("user not found")

	// ErrUserOrTeamNotFound defines the error if a user or team could not be found.
	ErrUserOrTeamNotFound = errors.New("user or team not found")

	// ErrTeamNotAssigned defines the error if a team is not assigned to a user.
	ErrTeamNotAssigned = errors.New("team is not assigned")

	// ErrTeamAlreadyAssigned defines the error if a team is already assigned to a user.
	ErrTeamAlreadyAssigned = errors.New("team is already assigned")
)

Functions

This section is empty.

Types

type GormRepository

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

GormRepository implements the UsersRepository interface.

func NewGormRepository

func NewGormRepository(handle *gorm.DB) *GormRepository

NewGormRepository initializes a new repository for GormDB.

func (*GormRepository) Create

func (r *GormRepository) Create(ctx context.Context, user *model.User) (*model.User, error)

Create implements the UsersRepository interface.

func (*GormRepository) Delete

func (r *GormRepository) Delete(ctx context.Context, name string) error

Delete implements the UsersRepository interface.

func (*GormRepository) Exists

func (r *GormRepository) Exists(ctx context.Context, name string) (bool, error)

Exists implements the UsersRepository interface.

func (*GormRepository) List

func (r *GormRepository) List(ctx context.Context) ([]*model.User, error)

List implements the UsersRepository interface.

func (*GormRepository) Show

func (r *GormRepository) Show(ctx context.Context, name string) (*model.User, error)

Show implements the UsersRepository interface.

func (*GormRepository) Update

func (r *GormRepository) Update(ctx context.Context, user *model.User) (*model.User, error)

Update implements the UsersRepository interface.

type LoggingRepository

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

LoggingRepository implements UsersRepository interface.

func (*LoggingRepository) Create

func (r *LoggingRepository) Create(ctx context.Context, user *model.User) (*model.User, error)

Create implements the UsersRepository interface.

func (*LoggingRepository) Delete

func (r *LoggingRepository) Delete(ctx context.Context, name string) error

Delete implements the UsersRepository interface.

func (*LoggingRepository) Exists

func (r *LoggingRepository) Exists(ctx context.Context, name string) (bool, error)

Exists implements the UsersRepository interface.

func (*LoggingRepository) List

func (r *LoggingRepository) List(ctx context.Context) ([]*model.User, error)

List implements the UsersRepository interface.

func (*LoggingRepository) Show

func (r *LoggingRepository) Show(ctx context.Context, name string) (*model.User, error)

Show implements the UsersRepository interface.

func (*LoggingRepository) Update

func (r *LoggingRepository) Update(ctx context.Context, user *model.User) (*model.User, error)

Update implements the UsersRepository interface.

type LoggingRequestID

type LoggingRequestID func(context.Context) string

LoggingRequestID returns the request ID as string for logging

type MetricsRepository

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

MetricsRepository implements UsersRepository interface.

func (*MetricsRepository) Create

func (r *MetricsRepository) Create(ctx context.Context, user *model.User) (*model.User, error)

Create implements the UsersRepository interface.

func (*MetricsRepository) Delete

func (r *MetricsRepository) Delete(ctx context.Context, name string) error

Delete implements the UsersRepository interface.

func (*MetricsRepository) Exists

func (r *MetricsRepository) Exists(ctx context.Context, name string) (bool, error)

Exists implements the UsersRepository interface.

func (*MetricsRepository) List

func (r *MetricsRepository) List(ctx context.Context) ([]*model.User, error)

List implements the UsersRepository interface.

func (*MetricsRepository) Show

func (r *MetricsRepository) Show(ctx context.Context, id string) (*model.User, error)

Show implements the UsersRepository interface.

func (*MetricsRepository) Update

func (r *MetricsRepository) Update(ctx context.Context, user *model.User) (*model.User, error)

Update implements the UsersRepository interface.

type MockUsersRepository

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

MockUsersRepository is a mock of UsersRepository interface.

func NewMockUsersRepository

func NewMockUsersRepository(ctrl *gomock.Controller) *MockUsersRepository

NewMockUsersRepository creates a new mock instance.

func (*MockUsersRepository) Create

func (m *MockUsersRepository) Create(arg0 context.Context, arg1 *model.User) (*model.User, error)

Create mocks base method.

func (*MockUsersRepository) Delete

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

Delete mocks base method.

func (*MockUsersRepository) EXPECT

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

func (*MockUsersRepository) Exists

func (m *MockUsersRepository) Exists(arg0 context.Context, arg1 string) (bool, error)

Exists mocks base method.

func (*MockUsersRepository) List

func (m *MockUsersRepository) List(arg0 context.Context) ([]*model.User, error)

List mocks base method.

func (*MockUsersRepository) Show

func (m *MockUsersRepository) Show(arg0 context.Context, arg1 string) (*model.User, error)

Show mocks base method.

func (*MockUsersRepository) Update

func (m *MockUsersRepository) Update(arg0 context.Context, arg1 *model.User) (*model.User, error)

Update mocks base method.

type MockUsersRepositoryMockRecorder

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

MockUsersRepositoryMockRecorder is the mock recorder for MockUsersRepository.

func (*MockUsersRepositoryMockRecorder) Create

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

Create indicates an expected call of Create.

func (*MockUsersRepositoryMockRecorder) Delete

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

Delete indicates an expected call of Delete.

func (*MockUsersRepositoryMockRecorder) Exists

func (mr *MockUsersRepositoryMockRecorder) Exists(arg0, arg1 interface{}) *gomock.Call

Exists indicates an expected call of Exists.

func (*MockUsersRepositoryMockRecorder) List

func (mr *MockUsersRepositoryMockRecorder) List(arg0 interface{}) *gomock.Call

List indicates an expected call of List.

func (*MockUsersRepositoryMockRecorder) Show

func (mr *MockUsersRepositoryMockRecorder) Show(arg0, arg1 interface{}) *gomock.Call

Show indicates an expected call of Show.

func (*MockUsersRepositoryMockRecorder) Update

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

Update indicates an expected call of Update.

type UsersRepository

type UsersRepository interface {
	List(context.Context) ([]*model.User, error)
	Create(context.Context, *model.User) (*model.User, error)
	Update(context.Context, *model.User) (*model.User, error)
	Show(context.Context, string) (*model.User, error)
	Delete(context.Context, string) error
	Exists(context.Context, string) (bool, error)
}

UsersRepository defines the required functions for the repository.

func NewLoggingRepository

func NewLoggingRepository(repository UsersRepository, requestID LoggingRequestID) UsersRepository

NewLoggingRepository wraps the UsersRepository and provides logging for its methods.

func NewMetricsRepository

func NewMetricsRepository(repository UsersRepository, metricz *metrics.Metrics) UsersRepository

NewMetricsRepository wraps the UsersRepository and provides metrics for its methods.

Jump to

Keyboard shortcuts

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