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

Function insertUserProfiles

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

Source from the content-addressed store, hash-verified

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(?, ?, ?, ?)`)
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
462func 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(?, ?, ?, ?)`)

Callers 2

replaceRuntimeSnapshotFunction · 0.85
replaceLegacySnapshotFunction · 0.85

Calls 2

boolToIntFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected