anime

package
v0.0.0-...-a554ddd Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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) Create

func (svc *Service) Create(anime Anime)

Create adds a new Anime to the MongoDB Collection

func (*Service) CreateHandler

func (svc *Service) CreateHandler(w http.ResponseWriter, r *http.Request)

CreateHandler for the Anime Collection

func (*Service) Delete

func (svc *Service) Delete(id int)

Delete removes the Anime from the Collection

func (*Service) Find

func (svc *Service) Find(t string) []Anime

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) FindAll

func (svc *Service) FindAll() []*Anime

FindAll retrieves all Animes

func (*Service) Read

func (svc *Service) Read(id int)

Read retrieves an Anime from the MongoDB Collection

func (*Service) SearchHandler

func (svc *Service) SearchHandler(w http.ResponseWriter, r *http.Request)

SearchHandler for the Anime Collection

func (*Service) Update

func (svc *Service) Update(anime Anime)

Update upserts the Anime in the Collection

type Title

type Title struct {
	Title    string `bson:"title"`
	Type     string `bson:"type"`
	Language string `bson:"language"`
}

Title defines the Name of an Anime, that varies in Type and Language

Jump to

Keyboard shortcuts

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