Skip to content

Instantly share code, notes, and snippets.

@qfrank
Created October 20, 2023 08:07
Show Gist options
  • Save qfrank/f5064d9aa8b940d519dd850c2f15399d to your computer and use it in GitHub Desktop.
Save qfrank/f5064d9aa8b940d519dd850c2f15399d to your computer and use it in GitHub Desktop.
Test DB(sqlite) for Notification ID
package protocol
import (
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/sqlite"
"github.com/stretchr/testify/require"
"testing"
)
func TestNotificationID(t *testing.T) {
id := defaultContactRequestID("0x040cc3635033886e5d2d1a230c25974f3c9b9d2c37166395e508f31937eeca7b87606a7d587a578d2072c3db68a58fb7b46a0cb6647c70a57c31626adf7d60cfb9")
println("id: ", id)
db, err := sqlite.OpenUnecryptedDB("/Users/xxx/Documents/tmp/export.db")
require.NoError(t, err)
defer db.Close()
rows, err := db.Query("SELECT COUNT(1) FROM activity_center_notifications WHERE id = ?", types.FromHex(id))
require.NoError(t, err)
var total int
if rows.Next() {
err = rows.Scan(&total)
require.NoError(t, err)
}
println("total: ", total)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment