(ctx context.Context, tx *sql.Tx, items []UserProfile)
| 445 | } |
| 446 | |
| 447 | func insertUserProfiles(ctx context.Context, tx *sql.Tx, items []UserProfile) error { |
| 448 | stmt, err := tx.PrepareContext(ctx, `INSERT INTO user_profiles(user_id, shown_assets, locale, subscribed) VALUES(?, ?, ?, ?)`) |
| 449 | if err != nil { |
| 450 | return err |
| 451 | } |
| 452 | defer stmt.Close() |
| 453 | |
| 454 | for _, item := range items { |
| 455 | if _, err := stmt.ExecContext(ctx, item.ID, boolToInt(item.ShownAssets), item.Locale, boolToInt(item.Subscribed)); err != nil { |
| 456 | return err |
| 457 | } |
| 458 | } |
| 459 | return nil |
| 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(?, ?, ?, ?)`) |
no test coverage detected