MCPcopy Create free account
hub / github.com/MMadmer/EpicAssetsNotifyBot / insertGuildConfigs

Function insertGuildConfigs

internal/store/sqlite/store.go:422–445  ·  view source on GitHub ↗
(ctx context.Context, tx *sql.Tx, items []GuildConfig)

Source from the content-addressed store, hash-verified

420}
421
422func 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
447func 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(?, ?, ?, ?)`)

Callers 1

replaceRuntimeSnapshotFunction · 0.85

Calls 2

boolToIntFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected