Documentation
¶
Overview ¶
Package db is a generated GoMock package.
Index ¶
- Variables
- type CreateOptions
- type DB
- type ListOptions
- type MockDB
- func (m *MockDB) Create(arg0 context.Context, arg1 *CreateOptions) (*model.Record, error)
- func (m *MockDB) Delete(arg0 context.Context, arg1 uuid.UUID) error
- func (m *MockDB) EXPECT() *MockDBMockRecorder
- func (m *MockDB) Get(arg0 context.Context, arg1 uuid.UUID) (*model.Record, error)
- func (m *MockDB) List(arg0 context.Context, arg1 *ListOptions) ([]*model.Record, error)
- func (m *MockDB) Update(arg0 context.Context, arg1 uuid.UUID, arg2 *UpdateOptions) (*model.Record, error)
- type MockDBMockRecorder
- func (mr *MockDBMockRecorder) Create(arg0, arg1 any) *gomock.Call
- func (mr *MockDBMockRecorder) Delete(arg0, arg1 any) *gomock.Call
- func (mr *MockDBMockRecorder) Get(arg0, arg1 any) *gomock.Call
- func (mr *MockDBMockRecorder) List(arg0, arg1 any) *gomock.Call
- func (mr *MockDBMockRecorder) Update(arg0, arg1, arg2 any) *gomock.Call
- type SQLDBConfig
- type UpdateOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidOptions = fmt.Errorf("invalid options") ErrInvalidRecordID = fmt.Errorf("invalid record id") ErrInvalidUserID = fmt.Errorf("invalid user id") ErrInvalidTitle = fmt.Errorf("invalid title") ErrInvalidFilters = fmt.Errorf("invalid filters") ErrNoRowsAffected = fmt.Errorf("no rows affected") )
Functions ¶
This section is empty.
Types ¶
type CreateOptions ¶
type CreateOptions struct {
// Title of the record.
Title string
// ID of the user who is creating the record.
UserID uuid.UUID
}
CreateOptions holds the options for creating a new record.
type DB ¶
type DB interface {
Create(context.Context, *CreateOptions) (*model.Record, error)
List(context.Context, *ListOptions) ([]*model.Record, error)
Get(context.Context, uuid.UUID) (*model.Record, error)
Update(context.Context, uuid.UUID, *UpdateOptions) (*model.Record, error)
Delete(context.Context, uuid.UUID) error
}
DB interface declares the signature of the database layer.
func NewSQLDB ¶
func NewSQLDB(config *SQLDBConfig) DB
type ListOptions ¶
type ListOptions struct {
// Title of the record.
Title string
// Skip for pagination.
Skip int
// Limit for pagination.
Limit int
// Order by field.
OrderBy string
// Order by direction.
OrderDirection string
}
ListOptions holds the options for listing records.
type MockDB ¶
type MockDB struct {
// contains filtered or unexported fields
}
MockDB is a mock of DB interface.
func NewMockDB ¶
func NewMockDB(ctrl *gomock.Controller) *MockDB
NewMockDB creates a new mock instance.
func (*MockDB) EXPECT ¶
func (m *MockDB) EXPECT() *MockDBMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockDBMockRecorder ¶
type MockDBMockRecorder struct {
// contains filtered or unexported fields
}
MockDBMockRecorder is the mock recorder for MockDB.
func (*MockDBMockRecorder) Create ¶
func (mr *MockDBMockRecorder) Create(arg0, arg1 any) *gomock.Call
Create indicates an expected call of Create.
func (*MockDBMockRecorder) Delete ¶
func (mr *MockDBMockRecorder) Delete(arg0, arg1 any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockDBMockRecorder) Get ¶
func (mr *MockDBMockRecorder) Get(arg0, arg1 any) *gomock.Call
Get indicates an expected call of Get.
type SQLDBConfig ¶
type UpdateOptions ¶
type UpdateOptions struct {
// Title of the record.
Title string
}
UpdateOptions holds the options for updating a record.
Click to show internal directories.
Click to hide internal directories.