Documentation ¶
Index ¶
- type RepositoryInterface
- type RepositoryInterfaceMock
- func (mock *RepositoryInterfaceMock) Create(repositoryParamJson RepositoryParamJson) error
- func (mock *RepositoryInterfaceMock) CreateCalls() []struct{ ... }
- func (mock *RepositoryInterfaceMock) Delete(id uuid.UUID) error
- func (mock *RepositoryInterfaceMock) DeleteCalls() []struct{ ... }
- func (mock *RepositoryInterfaceMock) GetAll() (RepositoryJsons, error)
- func (mock *RepositoryInterfaceMock) GetAllCalls() []struct{}
- func (mock *RepositoryInterfaceMock) GetById(id uuid.UUID) (RepositoryJson, error)
- func (mock *RepositoryInterfaceMock) GetByIdCalls() []struct{ ... }
- func (mock *RepositoryInterfaceMock) Update(id uuid.UUID, param RepositoryParamJson) error
- func (mock *RepositoryInterfaceMock) UpdateCalls() []struct{ ... }
- type RepositoryJson
- type RepositoryJsons
- type RepositoryParamJson
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RepositoryInterface ¶
type RepositoryInterface interface { GetAll() (RepositoryJsons, error) GetById(id uuid.UUID) (RepositoryJson, error) Create(RepositoryParamJson) error Update(id uuid.UUID, param RepositoryParamJson) error Delete(id uuid.UUID) error }
type RepositoryInterfaceMock ¶
type RepositoryInterfaceMock struct { // CreateFunc mocks the Create method. CreateFunc func(repositoryParamJson RepositoryParamJson) error // DeleteFunc mocks the Delete method. DeleteFunc func(id uuid.UUID) error // GetAllFunc mocks the GetAll method. GetAllFunc func() (RepositoryJsons, error) // GetByIdFunc mocks the GetById method. GetByIdFunc func(id uuid.UUID) (RepositoryJson, error) // UpdateFunc mocks the Update method. UpdateFunc func(id uuid.UUID, param RepositoryParamJson) error // contains filtered or unexported fields }
RepositoryInterfaceMock is a mock implementation of RepositoryInterface.
func TestSomethingThatUsesRepositoryInterface(t *testing.T) { // make and configure a mocked RepositoryInterface mockedRepositoryInterface := &RepositoryInterfaceMock{ CreateFunc: func(repositoryParamJson RepositoryParamJson) error { panic("mock out the Create method") }, DeleteFunc: func(id uuid.UUID) error { panic("mock out the Delete method") }, GetAllFunc: func() (RepositoryJsons, error) { panic("mock out the GetAll method") }, GetByIdFunc: func(id uuid.UUID) (RepositoryJson, error) { panic("mock out the GetById method") }, UpdateFunc: func(id uuid.UUID, param RepositoryParamJson) error { panic("mock out the Update method") }, } // use mockedRepositoryInterface in code that requires RepositoryInterface // and then make assertions. }
func (*RepositoryInterfaceMock) Create ¶
func (mock *RepositoryInterfaceMock) Create(repositoryParamJson RepositoryParamJson) error
Create calls CreateFunc.
func (*RepositoryInterfaceMock) CreateCalls ¶
func (mock *RepositoryInterfaceMock) CreateCalls() []struct { RepositoryParamJson RepositoryParamJson }
CreateCalls gets all the calls that were made to Create. Check the length with:
len(mockedRepositoryInterface.CreateCalls())
func (*RepositoryInterfaceMock) Delete ¶
func (mock *RepositoryInterfaceMock) Delete(id uuid.UUID) error
Delete calls DeleteFunc.
func (*RepositoryInterfaceMock) DeleteCalls ¶
func (mock *RepositoryInterfaceMock) DeleteCalls() []struct { ID uuid.UUID }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedRepositoryInterface.DeleteCalls())
func (*RepositoryInterfaceMock) GetAll ¶
func (mock *RepositoryInterfaceMock) GetAll() (RepositoryJsons, error)
GetAll calls GetAllFunc.
func (*RepositoryInterfaceMock) GetAllCalls ¶
func (mock *RepositoryInterfaceMock) GetAllCalls() []struct { }
GetAllCalls gets all the calls that were made to GetAll. Check the length with:
len(mockedRepositoryInterface.GetAllCalls())
func (*RepositoryInterfaceMock) GetById ¶
func (mock *RepositoryInterfaceMock) GetById(id uuid.UUID) (RepositoryJson, error)
GetById calls GetByIdFunc.
func (*RepositoryInterfaceMock) GetByIdCalls ¶
func (mock *RepositoryInterfaceMock) GetByIdCalls() []struct { ID uuid.UUID }
GetByIdCalls gets all the calls that were made to GetById. Check the length with:
len(mockedRepositoryInterface.GetByIdCalls())
func (*RepositoryInterfaceMock) Update ¶
func (mock *RepositoryInterfaceMock) Update(id uuid.UUID, param RepositoryParamJson) error
Update calls UpdateFunc.
func (*RepositoryInterfaceMock) UpdateCalls ¶
func (mock *RepositoryInterfaceMock) UpdateCalls() []struct { ID uuid.UUID Param RepositoryParamJson }
UpdateCalls gets all the calls that were made to Update. Check the length with:
len(mockedRepositoryInterface.UpdateCalls())
type RepositoryJson ¶
type RepositoryJson struct { Id int64 `db:"id" gorm:"primaryKey,autoincrement" json:"id,omitempty"` Userid string `db:"userid" gorm:"size:255;not null" json:"userid,omitempty" validate:"required"` Username string `db:"username" gorm:"size:255;not null" json:"username,omitempty" validate:"required"` }
func (RepositoryJson) TableName ¶
func (RepositoryJson) TableName() string
type RepositoryJsons ¶
type RepositoryJsons []RepositoryJson
type RepositoryParamJson ¶
type RepositoryParamJson struct { Userid string `db:"userid" gorm:"size:255;not null"` Username string `db:"username" gorm:"size:255;not null"` }
func (RepositoryParamJson) TableName ¶
func (RepositoryParamJson) TableName() string
Click to show internal directories.
Click to hide internal directories.