user

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package user is a generated GoMock package.

Package user is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockRepo

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

MockRepo is a mock of Repo interface.

func NewMockRepo

func NewMockRepo(ctrl *gomock.Controller) *MockRepo

NewMockRepo creates a new mock instance.

func (*MockRepo) Delete

func (m *MockRepo) Delete(userID uint) error

Delete mocks base method.

func (*MockRepo) EXPECT

func (m *MockRepo) EXPECT() *MockRepoMockRecorder

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

func (*MockRepo) Get

func (m *MockRepo) Get(userID uint) (User, error)

Get mocks base method.

func (*MockRepo) GetByEmail

func (m *MockRepo) GetByEmail(email string) (User, error)

GetByEmail mocks base method.

func (*MockRepo) Save

func (m *MockRepo) Save(user User) (uint, error)

Save mocks base method.

type MockRepoMockRecorder

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

MockRepoMockRecorder is the mock recorder for MockRepo.

func (*MockRepoMockRecorder) Delete

func (mr *MockRepoMockRecorder) Delete(userID interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockRepoMockRecorder) Get

func (mr *MockRepoMockRecorder) Get(userID interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockRepoMockRecorder) GetByEmail

func (mr *MockRepoMockRecorder) GetByEmail(email interface{}) *gomock.Call

GetByEmail indicates an expected call of GetByEmail.

func (*MockRepoMockRecorder) Save

func (mr *MockRepoMockRecorder) Save(user interface{}) *gomock.Call

Save indicates an expected call of Save.

type MockService

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

MockService is a mock of Service interface.

func NewMockService

func NewMockService(ctrl *gomock.Controller) *MockService

NewMockService creates a new mock instance.

func (*MockService) Delete

func (m *MockService) Delete(userID uint) error

Delete mocks base method.

func (*MockService) EXPECT

func (m *MockService) EXPECT() *MockServiceMockRecorder

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

func (*MockService) Get

func (m *MockService) Get(userID uint) (User, error)

Get mocks base method.

func (*MockService) GetByEmail

func (m *MockService) GetByEmail(email string) (User, error)

GetByEmail mocks base method.

func (*MockService) Save

func (m *MockService) Save(user User) (uint, error)

Save mocks base method.

type MockServiceMockRecorder

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

MockServiceMockRecorder is the mock recorder for MockService.

func (*MockServiceMockRecorder) Delete

func (mr *MockServiceMockRecorder) Delete(userID interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockServiceMockRecorder) Get

func (mr *MockServiceMockRecorder) Get(userID interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockServiceMockRecorder) GetByEmail

func (mr *MockServiceMockRecorder) GetByEmail(email interface{}) *gomock.Call

GetByEmail indicates an expected call of GetByEmail.

func (*MockServiceMockRecorder) Save

func (mr *MockServiceMockRecorder) Save(user interface{}) *gomock.Call

Save indicates an expected call of Save.

type Repo

type Repo interface {
	Get(userID uint) (User, error)
	GetByEmail(email string) (User, error)
	Save(user User) (uint, error)
	Delete(userID uint) error
}

Repo represents a user repository. It provides methods to retrieve and manage user records from the database.

func NewRepository

func NewRepository(db *gorm.DB) Repo

NewRepository creates and returns a new instance of user repository.

type Service

type Service interface {
	Get(userID uint) (User, error)
	GetByEmail(email string) (User, error)
	Save(user User) (uint, error)
	Delete(userID uint) error
}

Service represents a user service. It provides different methods to manage app user.

func NewService

func NewService(repo Repo) Service

NewService creates and return a new user service.

type User

type User struct {
	gorm.Model

	Email          string
	Name           string
	Location       string
	AvatarURL      string
	GithubID       int64
	GithubUsername string
	GithubToken    string
	DisabledAt     *time.Time

	DefaultRepo *preference.DefaultRepo `gorm:"foreignkey:UserID"`
}

User represent an entity model used for storing and retrieving user to/from database.

Jump to

Keyboard shortcuts

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