Documentation ¶
Index ¶
- Variables
- type MemoryRepo
- func (m *MemoryRepo) Create(_ context.Context, req *todopb.CreateRequest) (*todopb.CreateResponse, error)
- func (m *MemoryRepo) Delete(_ context.Context, req *todopb.DeleteRequest) (*todopb.DeleteResponse, error)
- func (m *MemoryRepo) Get(_ context.Context, req *todopb.GetRequest) (*todopb.GetResponse, error)
- func (m *MemoryRepo) List(_ context.Context, _ *todopb.ListRequest) (*todopb.ListResponse, error)
- func (m *MemoryRepo) Update(_ context.Context, req *todopb.UpdateRequest) (*todopb.UpdateResponse, error)
- type MysqlRepo
- func (m *MysqlRepo) Create(ctx context.Context, req *todopb.CreateRequest) (*todopb.CreateResponse, error)
- func (m *MysqlRepo) Delete(ctx context.Context, req *todopb.DeleteRequest) (*todopb.DeleteResponse, error)
- func (m *MysqlRepo) Get(ctx context.Context, req *todopb.GetRequest) (*todopb.GetResponse, error)
- func (m *MysqlRepo) List(ctx context.Context, _ *todopb.ListRequest) (*todopb.ListResponse, error)
- func (m *MysqlRepo) Update(ctx context.Context, req *todopb.UpdateRequest) (*todopb.UpdateResponse, error)
- type Option
- type Repository
- type ServiceServer
- func (srv *ServiceServer) Create(ctx context.Context, req *todopb.CreateRequest) (*todopb.CreateResponse, error)
- func (srv *ServiceServer) Delete(ctx context.Context, req *todopb.DeleteRequest) (*todopb.DeleteResponse, error)
- func (srv *ServiceServer) Get(ctx context.Context, req *todopb.GetRequest) (*todopb.GetResponse, error)
- func (srv *ServiceServer) List(ctx context.Context, req *todopb.ListRequest) (*todopb.ListResponse, error)
- func (srv *ServiceServer) RegisterGRPC(s *grpc.Server)
- func (srv *ServiceServer) Update(ctx context.Context, req *todopb.UpdateRequest) (*todopb.UpdateResponse, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound is returned when a item is not found. ErrNotFound = errors.New("the item was not found in the repository") // ErrFailedToCreate is returned when a item is create Failed ErrFailedToCreate = errors.New("failed to add the todo to the repository") )
Functions ¶
This section is empty.
Types ¶
type MemoryRepo ¶
type MemoryRepo struct {
// contains filtered or unexported fields
}
MemoryRepo fulfills the Repository interface
func NewMemoryRepo ¶
func NewMemoryRepo() *MemoryRepo
NewMemoryRepo is a factory function to generate a new repository
func (*MemoryRepo) Create ¶
func (m *MemoryRepo) Create(_ context.Context, req *todopb.CreateRequest) (*todopb.CreateResponse, error)
func (*MemoryRepo) Delete ¶
func (m *MemoryRepo) Delete(_ context.Context, req *todopb.DeleteRequest) (*todopb.DeleteResponse, error)
func (*MemoryRepo) Get ¶
func (m *MemoryRepo) Get(_ context.Context, req *todopb.GetRequest) (*todopb.GetResponse, error)
func (*MemoryRepo) List ¶
func (m *MemoryRepo) List(_ context.Context, _ *todopb.ListRequest) (*todopb.ListResponse, error)
func (*MemoryRepo) Update ¶
func (m *MemoryRepo) Update(_ context.Context, req *todopb.UpdateRequest) (*todopb.UpdateResponse, error)
type MysqlRepo ¶
type MysqlRepo struct {
// contains filtered or unexported fields
}
MysqlRepo fulfills the Repository interface
func NewMysqlRepo ¶
NewMysqlRepo is a factory function to generate a new repository
func (*MysqlRepo) Create ¶
func (m *MysqlRepo) Create(ctx context.Context, req *todopb.CreateRequest) (*todopb.CreateResponse, error)
func (*MysqlRepo) Delete ¶
func (m *MysqlRepo) Delete(ctx context.Context, req *todopb.DeleteRequest) (*todopb.DeleteResponse, error)
func (*MysqlRepo) Get ¶
func (m *MysqlRepo) Get(ctx context.Context, req *todopb.GetRequest) (*todopb.GetResponse, error)
func (*MysqlRepo) List ¶
func (m *MysqlRepo) List(ctx context.Context, _ *todopb.ListRequest) (*todopb.ListResponse, error)
func (*MysqlRepo) Update ¶
func (m *MysqlRepo) Update(ctx context.Context, req *todopb.UpdateRequest) (*todopb.UpdateResponse, error)
type Option ¶
type Option func(*ServiceServer) error
Option is an alias for a function that will take in a pointer to an ServiceServer and modify it
func WithMemoryRepository ¶
func WithMemoryRepository() Option
WithMemoryRepository applies a memory repository to the Option
func WithMysqlRepository ¶
WithMysqlRepository applies a memory repository to the Option
func WithRepository ¶
func WithRepository(repo Repository) Option
WithRepository applies a given repository to the ServiceServer
type Repository ¶
type Repository interface { todopb.ToDoServiceServer }
Repository is a interface that defines the rules around what a customer repository Has to be able to perform
type ServiceServer ¶
type ServiceServer struct { todopb.UnimplementedToDoServiceServer // contains filtered or unexported fields }
func NewServiceServer ¶
func NewServiceServer(logger log.Logger, opts ...Option) (*ServiceServer, error)
func (*ServiceServer) Create ¶
func (srv *ServiceServer) Create(ctx context.Context, req *todopb.CreateRequest) (*todopb.CreateResponse, error)
func (*ServiceServer) Delete ¶
func (srv *ServiceServer) Delete(ctx context.Context, req *todopb.DeleteRequest) (*todopb.DeleteResponse, error)
func (*ServiceServer) Get ¶
func (srv *ServiceServer) Get(ctx context.Context, req *todopb.GetRequest) (*todopb.GetResponse, error)
func (*ServiceServer) List ¶
func (srv *ServiceServer) List(ctx context.Context, req *todopb.ListRequest) (*todopb.ListResponse, error)
func (*ServiceServer) RegisterGRPC ¶
func (srv *ServiceServer) RegisterGRPC(s *grpc.Server)
func (*ServiceServer) Update ¶
func (srv *ServiceServer) Update(ctx context.Context, req *todopb.UpdateRequest) (*todopb.UpdateResponse, error)
Click to show internal directories.
Click to hide internal directories.