(ctx context.Context, argsCategory CategoryParams, argsCourse CourseParams)
| 52 | } |
| 53 | |
| 54 | func (c *CourseDB) CreateCourseAndCategory(ctx context.Context, argsCategory CategoryParams, argsCourse CourseParams) error { |
| 55 | err := c.callTx(ctx, func(q *db.Queries) error { |
| 56 | var err error |
| 57 | err = q.CreateCategory(ctx, db.CreateCategoryParams{ |
| 58 | ID: argsCategory.ID, |
| 59 | Name: argsCategory.Name, |
| 60 | Description: argsCategory.Description, |
| 61 | }) |
| 62 | if err != nil { |
| 63 | return err |
| 64 | } |
| 65 | err = q.CreateCourse(ctx, db.CreateCourseParams{ |
| 66 | ID: argsCourse.ID, |
| 67 | Name: argsCourse.Name, |
| 68 | Description: argsCourse.Description, |
| 69 | CategoryID: argsCategory.ID, |
| 70 | Price: argsCourse.Price, |
| 71 | }) |
| 72 | if err != nil { |
| 73 | return err |
| 74 | } |
| 75 | return nil |
| 76 | }) |
| 77 | if err != nil { |
| 78 | return err |
| 79 | } |
| 80 | return nil |
| 81 | } |
| 82 | |
| 83 | func main() { |
| 84 | ctx := context.Background() |
nothing calls this directly
no test coverage detected