repository

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientRepository added in v0.2.0

type ClientRepository interface {
	DeleteAuthorQuotes(authorID string) (bool, error)
}

func NewClientRepository added in v0.2.0

func NewClientRepository(clientInfo mgrpc.ClientInfo) (ClientRepository, error)

NewClientRepository creates a new client repository.

type Database

type Database interface {
	AddAuthor(author data.Author) (string, error)
	ListAll() []data.Author
	UpdateAuthor(author data.Author) (data.Author, error)
	DeleteAuthor(id string) error
	GetAuthor(id string) (data.Author, error)
}

func NewInMemoryDatabase added in v0.2.0

func NewInMemoryDatabase() Database

NewInMemoryDatabase creates a new InMemoryDatabase.

func NewMongoDatabase

func NewMongoDatabase(connection *mdb.MongoConnection) Database

NewMongoDatabase creates a new mongo database.

type FakeClientRepository added in v0.2.0

type FakeClientRepository struct {
	ClientRepository
	// contains filtered or unexported fields
}

func NewFakeClientRepository added in v0.2.0

func NewFakeClientRepository() *FakeClientRepository

func (*FakeClientRepository) DeleteAuthorQuotes added in v0.2.0

func (f *FakeClientRepository) DeleteAuthorQuotes(_ string) (bool, error)

func (*FakeClientRepository) SetDeleteAuthorQuotesReturn added in v0.2.0

func (f *FakeClientRepository) SetDeleteAuthorQuotesReturn(ret bool, err error)

type Repository

type Repository interface {
	AddAuthor(author data.Author) (string, error)
	ListAll() []data.Author
	UpdateAuthor(author data.Author) (data.Author, error)
	DeleteAuthor(id string) error
	GetAuthor(id string) (data.Author, error)
}

Repository represents the repository interface.

func New

func New(db Database, clientRepository ClientRepository) Repository

New creates a new repository.

Jump to

Keyboard shortcuts

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