// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.31.1 // source: fingerprints.sql package dbq import ( "context" "github.com/jackc/pgx/v5/pgtype" ) const deleteTrackFingerprint = `-- name: DeleteTrackFingerprint :exec DELETE FROM track_fingerprints WHERE track_id = $1 ` // A file changed but could not be fingerprinted, for a reason unrelated to the // file. The stored row describes the OLD bytes, so it goes and the backfill // re-derives it — nothing may keep trusting a stale identity. func (q *Queries) DeleteTrackFingerprint(ctx context.Context, trackID pgtype.UUID) error { _, err := q.db.Exec(ctx, deleteTrackFingerprint, trackID) return err } const upsertTrackFingerprint = `-- name: UpsertTrackFingerprint :exec INSERT INTO track_fingerprints ( track_id, audio_stream_sha256, chromaprint, fingerprint_version ) VALUES ( $1, $2, $3, $4 ) ON CONFLICT (track_id) DO UPDATE SET audio_stream_sha256 = EXCLUDED.audio_stream_sha256, chromaprint = EXCLUDED.chromaprint, fingerprint_version = EXCLUDED.fingerprint_version, computed_at = now() ` type UpsertTrackFingerprintParams struct { TrackID pgtype.UUID AudioStreamSha256 []byte Chromaprint []int32 FingerprintVersion int16 } // Written whenever a track's fingerprint is derived: by the scan when a file is // new or its bytes changed, and by the backfill (#3908) for rows derived by an // older method. Replaces the row wholesale — a fingerprint of the old bytes has // no standing once the file has changed. func (q *Queries) UpsertTrackFingerprint(ctx context.Context, arg UpsertTrackFingerprintParams) error { _, err := q.db.Exec(ctx, upsertTrackFingerprint, arg.TrackID, arg.AudioStreamSha256, arg.Chromaprint, arg.FingerprintVersion, ) return err }