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

Function insertAssets

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

Source from the content-addressed store, hash-verified

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(?, ?, ?, ?)`)
464 if err != nil {
465 return err
466 }
467 defer stmt.Close()
468
469 for idx, item := range items {
470 position := idx + 1
471 if item.Link == "" {
472 continue
473 }
474 if _, err := stmt.ExecContext(ctx, position, item.Name, item.Link, item.Image); err != nil {
475 return err
476 }
477 }
478 return nil
479}
480
481func storeDeadline(ctx context.Context, tx *sql.Tx, deadline any) error {
482 encoded, err := json.Marshal(deadline)

Callers 2

replaceRuntimeSnapshotFunction · 0.85
replaceLegacySnapshotFunction · 0.85

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected