repositories

package
v0.0.0-...-3ecb42e Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package repositories is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSessionNotFound  = errors.New("Session record not found")
	ConflictingIdsError = errors.New("Session already exists with a different ID")
	InfoConflictError   = errors.New("Session exists with different info")
)
View Source
var ErrClientNotFound = errors.New("record not found")

Functions

func CombineDateAndTime

func CombineDateAndTime(date time.Time, timePart time.Time) time.Time

func ToDomainClient

func ToDomainClient(client RepoClient) models.Client

func ToDomainSession

func ToDomainSession(repoSession RepoSession) models.Session

Types

type ClientRepository

type ClientRepository interface {
	GetAll() ([]models.Client, error)
	Insert(client *models.Client) error
	Delete(client *models.Client) error
	GetByName(name string) (*models.Client, error)
	SafeGetByName(name string) (*models.Client, error)
	Rename(client *models.Client, newName string) error
	Update(client *models.Client) error
}

type DateOnly

type DateOnly struct {
	time.Time
}

func ToDateOnly

func ToDateOnly(t time.Time) DateOnly

type GORMClientRepository

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

func NewGORMClientRepository

func NewGORMClientRepository(db *gorm.DB) *GORMClientRepository

func (*GORMClientRepository) Delete

func (repo *GORMClientRepository) Delete(client *models.Client) error

func (*GORMClientRepository) GetAll

func (repo *GORMClientRepository) GetAll() ([]models.Client, error)

func (*GORMClientRepository) GetByName

func (repo *GORMClientRepository) GetByName(name string) (*models.Client, error)

func (*GORMClientRepository) Insert

func (repo *GORMClientRepository) Insert(client *models.Client) error

func (*GORMClientRepository) Rename

func (repo *GORMClientRepository) Rename(client *models.Client, newName string) error

func (*GORMClientRepository) SafeGetByName

func (repo *GORMClientRepository) SafeGetByName(name string) (*models.Client, error)

func (*GORMClientRepository) Update

func (repo *GORMClientRepository) Update(client *models.Client) error

type GORMSessionRepository

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

func NewGORMSessionRepository

func NewGORMSessionRepository(db *gorm.DB) *GORMSessionRepository

func (*GORMSessionRepository) Delete

func (repo *GORMSessionRepository) Delete(session *models.Session, dryRun bool) error

func (*GORMSessionRepository) GetAllSessions

func (repo *GORMSessionRepository) GetAllSessions(client models.Client) (*[]models.Session, error)

func (*GORMSessionRepository) GetAllSessionsAllClients

func (repo *GORMSessionRepository) GetAllSessionsAllClients() (*[]models.Session, error)

func (*GORMSessionRepository) GetAllSessionsBetweenDates

func (repo *GORMSessionRepository) GetAllSessionsBetweenDates(start time.Time, end time.Time) (*[]models.Session, error)

func (*GORMSessionRepository) GetLastSessions

func (repo *GORMSessionRepository) GetLastSessions(count uint32, client *models.Client) (*[]models.Session, error)

func (*GORMSessionRepository) GetLatestSession

func (repo *GORMSessionRepository) GetLatestSession() (*models.Session, error)

func (*GORMSessionRepository) GetLatestSessionOnSpecificDate

func (repo *GORMSessionRepository) GetLatestSessionOnSpecificDate(date time.Time, client models.Client) (*models.Session, error)

func (*GORMSessionRepository) GetLatestSessionOnSpecificDateAllClients

func (repo *GORMSessionRepository) GetLatestSessionOnSpecificDateAllClients(date time.Time) (*[]models.Session, error)

func (*GORMSessionRepository) GetSessionByID

func (repo *GORMSessionRepository) GetSessionByID(id uint32) (*models.Session, error)

func (*GORMSessionRepository) Insert

func (repo *GORMSessionRepository) Insert(session *models.Session, dryRun bool) error

func (*GORMSessionRepository) Update

func (repo *GORMSessionRepository) Update(session *models.Session, dryRun bool) error

func (*GORMSessionRepository) Upsert

func (repo *GORMSessionRepository) Upsert(session *models.Session, dryRun bool) error

type MockClientRepository

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

MockClientRepository is a mock of ClientRepository interface.

func NewMockClientRepository

func NewMockClientRepository(ctrl *gomock.Controller) *MockClientRepository

NewMockClientRepository creates a new mock instance.

func (*MockClientRepository) Delete

func (m *MockClientRepository) Delete(client *models.Client) error

Delete mocks base method.

func (*MockClientRepository) EXPECT

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

func (*MockClientRepository) GetAll

func (m *MockClientRepository) GetAll() ([]models.Client, error)

GetAll mocks base method.

func (*MockClientRepository) GetByName

func (m *MockClientRepository) GetByName(name string) (*models.Client, error)

GetByName mocks base method.

func (*MockClientRepository) Insert

func (m *MockClientRepository) Insert(client *models.Client) error

Insert mocks base method.

func (*MockClientRepository) Rename

func (m *MockClientRepository) Rename(client *models.Client, newName string) error

Rename mocks base method.

func (*MockClientRepository) SafeGetByName

func (m *MockClientRepository) SafeGetByName(name string) (*models.Client, error)

SafeGetByName mocks base method.

func (*MockClientRepository) Update

func (m *MockClientRepository) Update(client *models.Client) error

Update mocks base method.

type MockClientRepositoryMockRecorder

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

MockClientRepositoryMockRecorder is the mock recorder for MockClientRepository.

func (*MockClientRepositoryMockRecorder) Delete

func (mr *MockClientRepositoryMockRecorder) Delete(client interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockClientRepositoryMockRecorder) GetAll

GetAll indicates an expected call of GetAll.

func (*MockClientRepositoryMockRecorder) GetByName

func (mr *MockClientRepositoryMockRecorder) GetByName(name interface{}) *gomock.Call

GetByName indicates an expected call of GetByName.

func (*MockClientRepositoryMockRecorder) Insert

func (mr *MockClientRepositoryMockRecorder) Insert(client interface{}) *gomock.Call

Insert indicates an expected call of Insert.

func (*MockClientRepositoryMockRecorder) Rename

func (mr *MockClientRepositoryMockRecorder) Rename(client, newName interface{}) *gomock.Call

Rename indicates an expected call of Rename.

func (*MockClientRepositoryMockRecorder) SafeGetByName

func (mr *MockClientRepositoryMockRecorder) SafeGetByName(name interface{}) *gomock.Call

SafeGetByName indicates an expected call of SafeGetByName.

func (*MockClientRepositoryMockRecorder) Update

func (mr *MockClientRepositoryMockRecorder) Update(client interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockSessionRepository

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

MockSessionRepository is a mock of SessionRepository interface.

func NewMockSessionRepository

func NewMockSessionRepository(ctrl *gomock.Controller) *MockSessionRepository

NewMockSessionRepository creates a new mock instance.

func (*MockSessionRepository) Delete

func (m *MockSessionRepository) Delete(session *models.Session, dryRun bool) error

Delete mocks base method.

func (*MockSessionRepository) EXPECT

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

func (*MockSessionRepository) GetAllSessions

func (m *MockSessionRepository) GetAllSessions(client models.Client) (*[]models.Session, error)

GetAllSessions mocks base method.

func (*MockSessionRepository) GetAllSessionsAllClients

func (m *MockSessionRepository) GetAllSessionsAllClients() (*[]models.Session, error)

GetAllSessionsAllClients mocks base method.

func (*MockSessionRepository) GetAllSessionsBetweenDates

func (m *MockSessionRepository) GetAllSessionsBetweenDates(start, end time.Time) (*[]models.Session, error)

GetAllSessionsBetweenDates mocks base method.

func (*MockSessionRepository) GetLastSessions

func (m *MockSessionRepository) GetLastSessions(arg0 uint32, arg1 *models.Client) (*[]models.Session, error)

GetLastSessions mocks base method.

func (*MockSessionRepository) GetLatestSession

func (m *MockSessionRepository) GetLatestSession() (*models.Session, error)

GetLatestSession mocks base method.

func (*MockSessionRepository) GetLatestSessionOnSpecificDate

func (m *MockSessionRepository) GetLatestSessionOnSpecificDate(date time.Time, client models.Client) (*models.Session, error)

GetLatestSessionOnSpecificDate mocks base method.

func (*MockSessionRepository) GetLatestSessionOnSpecificDateAllClients

func (m *MockSessionRepository) GetLatestSessionOnSpecificDateAllClients(date time.Time) (*[]models.Session, error)

GetLatestSessionOnSpecificDateAllClients mocks base method.

func (*MockSessionRepository) GetSessionByID

func (m *MockSessionRepository) GetSessionByID(id uint32) (*models.Session, error)

GetSessionByID mocks base method.

func (*MockSessionRepository) Insert

func (m *MockSessionRepository) Insert(session *models.Session, dryRun bool) error

Insert mocks base method.

func (*MockSessionRepository) Update

func (m *MockSessionRepository) Update(session *models.Session, dryRun bool) error

Update mocks base method.

func (*MockSessionRepository) Upsert

func (m *MockSessionRepository) Upsert(session *models.Session, dryRun bool) error

Upsert mocks base method.

type MockSessionRepositoryMockRecorder

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

MockSessionRepositoryMockRecorder is the mock recorder for MockSessionRepository.

func (*MockSessionRepositoryMockRecorder) Delete

func (mr *MockSessionRepositoryMockRecorder) Delete(session, dryRun interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockSessionRepositoryMockRecorder) GetAllSessions

func (mr *MockSessionRepositoryMockRecorder) GetAllSessions(client interface{}) *gomock.Call

GetAllSessions indicates an expected call of GetAllSessions.

func (*MockSessionRepositoryMockRecorder) GetAllSessionsAllClients

func (mr *MockSessionRepositoryMockRecorder) GetAllSessionsAllClients() *gomock.Call

GetAllSessionsAllClients indicates an expected call of GetAllSessionsAllClients.

func (*MockSessionRepositoryMockRecorder) GetAllSessionsBetweenDates

func (mr *MockSessionRepositoryMockRecorder) GetAllSessionsBetweenDates(start, end interface{}) *gomock.Call

GetAllSessionsBetweenDates indicates an expected call of GetAllSessionsBetweenDates.

func (*MockSessionRepositoryMockRecorder) GetLastSessions

func (mr *MockSessionRepositoryMockRecorder) GetLastSessions(arg0, arg1 interface{}) *gomock.Call

GetLastSessions indicates an expected call of GetLastSessions.

func (*MockSessionRepositoryMockRecorder) GetLatestSession

func (mr *MockSessionRepositoryMockRecorder) GetLatestSession() *gomock.Call

GetLatestSession indicates an expected call of GetLatestSession.

func (*MockSessionRepositoryMockRecorder) GetLatestSessionOnSpecificDate

func (mr *MockSessionRepositoryMockRecorder) GetLatestSessionOnSpecificDate(date, client interface{}) *gomock.Call

GetLatestSessionOnSpecificDate indicates an expected call of GetLatestSessionOnSpecificDate.

func (*MockSessionRepositoryMockRecorder) GetLatestSessionOnSpecificDateAllClients

func (mr *MockSessionRepositoryMockRecorder) GetLatestSessionOnSpecificDateAllClients(date interface{}) *gomock.Call

GetLatestSessionOnSpecificDateAllClients indicates an expected call of GetLatestSessionOnSpecificDateAllClients.

func (*MockSessionRepositoryMockRecorder) GetSessionByID

func (mr *MockSessionRepositoryMockRecorder) GetSessionByID(id interface{}) *gomock.Call

GetSessionByID indicates an expected call of GetSessionByID.

func (*MockSessionRepositoryMockRecorder) Insert

func (mr *MockSessionRepositoryMockRecorder) Insert(session, dryRun interface{}) *gomock.Call

Insert indicates an expected call of Insert.

func (*MockSessionRepositoryMockRecorder) Update

func (mr *MockSessionRepositoryMockRecorder) Update(session, dryRun interface{}) *gomock.Call

Update indicates an expected call of Update.

func (*MockSessionRepositoryMockRecorder) Upsert

func (mr *MockSessionRepositoryMockRecorder) Upsert(session, dryRun interface{}) *gomock.Call

Upsert indicates an expected call of Upsert.

type RepoClient

type RepoClient struct {
	Name     string `gorm:"primaryKey;collate:NOCASE"`
	PPH      uint16
	Currency string
}

func ToRepoClient

func ToRepoClient(client models.Client) *RepoClient

type RepoSession

type RepoSession struct {
	ID         *uint32 `gorm:"primaryKey;autoIncrement"`
	ClientName string  `gorm:"foreignKey:Name"`
	Start      *time.Time
	End        *time.Time
	Note       string
	Client     RepoClient `gorm:"foreignKey:ClientName;references:Name"`
}

func ToRepoSession

func ToRepoSession(session models.Session) RepoSession

type SessionRepository

type SessionRepository interface {
	Insert(session *models.Session, dryRun bool) error
	Upsert(session *models.Session, dryRun bool) error
	Update(session *models.Session, dryRun bool) error
	Delete(session *models.Session, dryRun bool) error
	GetSessionByID(id uint32) (*models.Session, error)
	GetAllSessions(client models.Client) (*[]models.Session, error)
	GetAllSessionsBetweenDates(start time.Time, end time.Time) (*[]models.Session, error)
	GetAllSessionsAllClients() (*[]models.Session, error)
	GetLatestSession() (*models.Session, error)
	GetLatestSessionOnSpecificDate(date time.Time, client models.Client) (*models.Session, error)
	GetLatestSessionOnSpecificDateAllClients(date time.Time) (*[]models.Session, error)
	GetLastSessions(uint32, *models.Client) (*[]models.Session, error)
}

type TimeOnly

type TimeOnly struct {
	time.Time
}

func ToTimeOnly

func ToTimeOnly(t time.Time) TimeOnly

Jump to

Keyboard shortcuts

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