Documentation ¶
Index ¶
- type Anime
- type Service
- func (svc *Service) Create(anime Anime)
- func (svc *Service) CreateHandler(w http.ResponseWriter, r *http.Request)
- func (svc *Service) Delete(id int)
- func (svc *Service) Find(t string) []Anime
- func (svc *Service) FindAll() []*Anime
- func (svc *Service) Read(id int)
- func (svc *Service) SearchHandler(w http.ResponseWriter, r *http.Request)
- func (svc *Service) Update(anime Anime)
- type Title
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anime ¶
type Anime struct { ID *primitive.ObjectID `bson:"_id,omitempty"` Titles []Title `bson:"titles"` // List of alternative titles Year int `bson:"year"` Genres []string `bson:"genres"` }
Anime is a Document stored in MongoDB
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides necessary dependencies
func NewService ¶
func NewService(logger log.Logger, collection *mongo.Collection) *Service
NewService creates a new Instance
func (*Service) CreateHandler ¶
func (svc *Service) CreateHandler(w http.ResponseWriter, r *http.Request)
CreateHandler for the Anime Collection
func (*Service) Find ¶
Find Searches for Animes matching the query XXX: When searching with an index, we only get the ObjectIDs in return. We Need to fix that
func (*Service) SearchHandler ¶
func (svc *Service) SearchHandler(w http.ResponseWriter, r *http.Request)
SearchHandler for the Anime Collection
Click to show internal directories.
Click to hide internal directories.