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

Function forwardIteration

examples/iterator/main.go:45–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43}
44
45func forwardIteration() {
46 fmt.Println("--------begin forwardIteration--------")
47 tx, err := db.Begin(false)
48 if err != nil {
49 panic(err)
50 }
51 iterator := nutsdb.NewIterator(tx, bucket, nutsdb.IteratorOptions{Reverse: false})
52 for {
53 value, _ := iterator.Value()
54 fmt.Println("Key: ", string(iterator.Key()))
55 fmt.Println("Value: ", string(value))
56 fmt.Println()
57 if !iterator.Next() {
58 break
59 }
60 }
61 err = tx.Commit()
62 if err != nil {
63 panic(err)
64 }
65 fmt.Println("--------end forwardIteration--------")
66}
67
68func reverseIterative() {
69 fmt.Println("--------start reverseIterative--------")

Callers 1

mainFunction · 0.85

Calls 6

ValueMethod · 0.95
KeyMethod · 0.95
NextMethod · 0.95
NewIteratorFunction · 0.92
BeginMethod · 0.80
CommitMethod · 0.80

Tested by

no test coverage detected