MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / txZPop

Function txZPop

db_test.go:611–632  ·  view source on GitHub ↗
(t *testing.T, db *DB, bucket string, key []byte, isMax bool, expectVal []byte, expectScore float64, expectErr error)

Source from the content-addressed store, hash-verified

609}
610
611func txZPop(t *testing.T, db *DB, bucket string, key []byte, isMax bool, expectVal []byte, expectScore float64, expectErr error) {
612 err := db.Update(func(tx *Tx) error {
613 var (
614 member *SortedSetMember
615 err error
616 )
617 if isMax {
618 member, err = tx.ZPopMax(bucket, key)
619 } else {
620 member, err = tx.ZPopMin(bucket, key)
621 }
622
623 if expectErr != nil {
624 assert.Equal(t, expectErr, err)
625 } else {
626 assert.Equal(t, expectVal, member.Value)
627 assert.Equal(t, expectScore, member.Score)
628 }
629 return nil
630 })
631 assert.NoError(t, err)
632}
633
634func txZPeekMin(t *testing.T, db *DB, bucket string, key, expectVal []byte, expectScore float64, expectErr, finalExpectErr error) {
635 err := db.View(func(tx *Tx) error {

Callers 4

TestDB_WatchFunction · 0.85
TestTx_ZPopFunction · 0.85
TestTx_ZPeekMinFunction · 0.85

Calls 3

UpdateMethod · 0.80
ZPopMaxMethod · 0.45
ZPopMinMethod · 0.45

Tested by

no test coverage detected