(ctx context.Context, tx *sql.Tx, items []GuildConfig)
| 420 | } |
| 421 | |
| 422 | func insertGuildConfigs(ctx context.Context, tx *sql.Tx, items []GuildConfig) error { |
| 423 | stmt, err := tx.PrepareContext(ctx, `INSERT INTO guild_configs(guild_id, channel_id, thread_id, shown_assets, locale, mention_role_id, enabled, include_images) VALUES(?, ?, ?, ?, ?, ?, ?, ?)`) |
| 424 | if err != nil { |
| 425 | return err |
| 426 | } |
| 427 | defer stmt.Close() |
| 428 | |
| 429 | for _, item := range items { |
| 430 | if _, err := stmt.ExecContext( |
| 431 | ctx, |
| 432 | item.GuildID, |
| 433 | item.ChannelID, |
| 434 | item.ThreadID, |
| 435 | boolToInt(item.ShownAssets), |
| 436 | item.Locale, |
| 437 | item.MentionRoleID, |
| 438 | boolToInt(item.Enabled), |
| 439 | boolToInt(item.IncludeImages), |
| 440 | ); err != nil { |
| 441 | return err |
| 442 | } |
| 443 | } |
| 444 | return nil |
| 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(?, ?, ?, ?)`) |
no test coverage detected