(ctx context.Context, tx *sql.Tx, items []Asset)
| 460 | } |
| 461 | |
| 462 | func insertAssets(ctx context.Context, tx *sql.Tx, items []Asset) error { |
| 463 | stmt, err := tx.PrepareContext(ctx, `INSERT INTO current_assets(position, name, link, image) VALUES(?, ?, ?, ?)`) |
| 464 | if err != nil { |
| 465 | return err |
| 466 | } |
| 467 | defer stmt.Close() |
| 468 | |
| 469 | for idx, item := range items { |
| 470 | position := idx + 1 |
| 471 | if item.Link == "" { |
| 472 | continue |
| 473 | } |
| 474 | if _, err := stmt.ExecContext(ctx, position, item.Name, item.Link, item.Image); err != nil { |
| 475 | return err |
| 476 | } |
| 477 | } |
| 478 | return nil |
| 479 | } |
| 480 | |
| 481 | func storeDeadline(ctx context.Context, tx *sql.Tx, deadline any) error { |
| 482 | encoded, err := json.Marshal(deadline) |
no test coverage detected