Documentation ¶
Index ¶
- Variables
- func ListenGRPC(s Service, port int) error
- type Client
- func (c *Client) Close()
- func (c *Client) GetProduct(ctx context.Context, id string) (*Product, error)
- func (c *Client) GetProducts(ctx context.Context, skip uint64, take uint64, ids []string, query string) ([]Product, error)
- func (c *Client) PostProduct(ctx context.Context, name, description string, price float64) (*Product, error)
- type Product
- type Repository
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("Entity not found")
)
Functions ¶
func ListenGRPC ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetProduct ¶
func (*Client) GetProducts ¶
type Repository ¶
type Repository interface { Close() PutProduct(ctx context.Context, p Product) error GetProductByID(ctx context.Context, id string) (*Product, error) ListProducts(ctx context.Context, skip uint64, take uint64) ([]Product, error) ListProductsWithIDs(ctx context.Context, ids []string) ([]Product, error) SearchProducts(ctx context.Context, query string, skip uint64, take uint64) ([]Product, error) }
func NewElasticRepository ¶
func NewElasticRepository(url string) (Repository, error)
type Service ¶
type Service interface { PostProduct(ctx context.Context, name, description string, price float64) (*Product, error) GetProduct(ctx context.Context, id string) (*Product, error) GetProducts(ctx context.Context, skip uint64, take uint64) ([]Product, error) GetProductsByIDs(ctx context.Context, ids []string) ([]Product, error) SearchProducts(ctx context.Context, query string, skip uint64, take uint64) ([]Product, error) }
func NewService ¶
func NewService(r Repository) Service
Click to show internal directories.
Click to hide internal directories.