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

Function txPop

db_test.go:668–688  ·  view source on GitHub ↗
(t *testing.T, db *DB, bucket string, key, expectVal []byte, expectErr error, isLeft bool)

Source from the content-addressed store, hash-verified

666}
667
668func txPop(t *testing.T, db *DB, bucket string, key, expectVal []byte, expectErr error, isLeft bool) {
669 err := db.Update(func(tx *Tx) error {
670 var item []byte
671 var err error
672
673 if isLeft {
674 item, err = tx.LPop(bucket, key)
675 } else {
676 item, err = tx.RPop(bucket, key)
677 }
678
679 if expectErr != nil {
680 require.Equal(t, expectErr, err)
681 } else {
682 require.Equal(t, expectVal, item)
683 }
684
685 return nil
686 })
687 require.NoError(t, err)
688}
689
690func txPush(t *testing.T, db *DB, bucket string, key, val []byte, isLeft bool, expectErr error, finalExpectErr error) {
691 err := db.Update(func(tx *Tx) error {

Callers 12

TestTx_RPushFunction · 0.85
TestTx_LPushFunction · 0.85
TestTx_LPushRawFunction · 0.85
TestTx_RPushRawFunction · 0.85
TestTx_LPopFunction · 0.85
TestTx_RPopFunction · 0.85
TestTx_LRangeFunction · 0.85
TestDB_MergeForListFunction · 0.85

Calls 3

UpdateMethod · 0.80
LPopMethod · 0.45
RPopMethod · 0.45

Tested by

no test coverage detected