MCPcopy Create free account
hub / github.com/devfullcycle/goexpert / FindByCourseID

Method FindByCourseID

13-GraphQL/internal/database/category.go:47–55  ·  view source on GitHub ↗
(courseID string)

Source from the content-addressed store, hash-verified

45}
46
47func (c *Category) FindByCourseID(courseID string) (Category, error) {
48 var id, name, description string
49 err := c.db.QueryRow("SELECT c.id, c.name, c.description FROM categories c JOIN courses co ON c.id = co.category_id WHERE co.id = $1", courseID).
50 Scan(&id, &name, &description)
51 if err != nil {
52 return Category{}, err
53 }
54 return Category{ID: id, Name: name, Description: description}, nil
55}

Callers 1

CategoryMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected