| 286 | } |
| 287 | |
| 288 | func (s *Store) loadAssets(ctx context.Context) ([]Asset, error) { |
| 289 | rows, err := s.db.QueryContext( |
| 290 | ctx, |
| 291 | `SELECT position, name, link, image |
| 292 | FROM current_assets |
| 293 | ORDER BY position`, |
| 294 | ) |
| 295 | if err != nil { |
| 296 | return nil, err |
| 297 | } |
| 298 | defer rows.Close() |
| 299 | |
| 300 | var result []Asset |
| 301 | for rows.Next() { |
| 302 | var ( |
| 303 | position int64 |
| 304 | name sql.NullString |
| 305 | link string |
| 306 | image sql.NullString |
| 307 | ) |
| 308 | |
| 309 | if err := rows.Scan(&position, &name, &link, &image); err != nil { |
| 310 | return nil, err |
| 311 | } |
| 312 | |
| 313 | _ = position |
| 314 | record := Asset{Link: link} |
| 315 | if name.Valid { |
| 316 | value := name.String |
| 317 | record.Name = &value |
| 318 | } |
| 319 | if image.Valid { |
| 320 | value := image.String |
| 321 | record.Image = &value |
| 322 | } |
| 323 | result = append(result, record) |
| 324 | } |
| 325 | |
| 326 | return result, rows.Err() |
| 327 | } |
| 328 | |
| 329 | func (s *Store) loadDeadline(ctx context.Context) (any, error) { |
| 330 | var raw string |