Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface { Routes() *mux.Router Create(w http.ResponseWriter, r *http.Request) Update(w http.ResponseWriter, r *http.Request) Delete(w http.ResponseWriter, r *http.Request) GetAll(w http.ResponseWriter, r *http.Request) GetById(w http.ResponseWriter, r *http.Request) }
func NewHandler ¶
type Quote ¶
type Quote struct { Id string `json:"id" bson:"_id"` Author string `json:"author" bson:"author""` Text string `json:"text" bson:"text""` BookId string `json:"book_id" bson:"book_id"` }
func NewQuote ¶
func NewQuote(req QuoteRequest) *Quote
type QuoteRequest ¶
type Repository ¶
type Repository interface { Create(ctx context.Context, q *Quote) error Update(ctx context.Context, q *Quote) error Delete(ctx context.Context, id string) error GetAll(ctx context.Context) ([]Quote, error) GetById(ctx context.Context, id string) (*Quote, error) }
func NewMongoRepository ¶
func NewMongoRepository(col *mongo.Collection) Repository
type Service ¶
type Service interface { Create(ctx context.Context, q *Quote) error Update(ctx context.Context, q *Quote) error Delete(ctx context.Context, id string) error GetAll(ctx context.Context) ([]Quote, error) GetById(ctx context.Context, id string) (*Quote, error) }
func NewService ¶
func NewService(r Repository) Service
Click to show internal directories.
Click to hide internal directories.