todo

package
v0.0.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

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 (*MemoryRepo) Delete

func (*MemoryRepo) Get

func (*MemoryRepo) List

func (*MemoryRepo) Update

type MysqlRepo

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

MysqlRepo fulfills the Repository interface

func NewMysqlRepo

func NewMysqlRepo(db *sql.DB) (*MysqlRepo, error)

NewMysqlRepo is a factory function to generate a new repository

func (*MysqlRepo) Create

func (*MysqlRepo) Delete

func (*MysqlRepo) Get

func (*MysqlRepo) List

func (*MysqlRepo) Update

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

func WithMysqlRepository(dsn string) Option

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 (*ServiceServer) Delete

func (*ServiceServer) Get

func (*ServiceServer) List

func (*ServiceServer) RegisterGRPC

func (srv *ServiceServer) RegisterGRPC(s *grpc.Server)

func (*ServiceServer) Update

Jump to

Keyboard shortcuts

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