@@ -497,18 +497,20 @@ tidesdb_txn_free(txn);
497497### Cursor Operations
498498Cursors allow you to iterate through key-value pairs in a column family.
499499
500+ > You can use a `tidesdb_merge_cursor` if you want all keys to be sorted from all sources.
501+
500502#### Initializing a Cursor
501503```c
502504/*
503505* Initialize a cursor to iterate through key-value pairs
504506* A cursor allows bi-directional sequential access to the TidesDB isntance contents
505507*/
506- tidesdb_cursor_t *cursor = NULL;
508+ tidesdb_cursor_t *cursor = NULL; /* or tidesdb_merge_cursor_t */
507509tidesdb_err_t *err = tidesdb_cursor_init(
508510 tdb, /* TidesDB instance */
509511 "users", /* Column family name */
510512 &cursor /* Cursor pointer */
511- );
513+ ); /* or tidesdb_merge_cursor_init */
512514
513515if (err != NULL) {
514516 printf("Error initializing cursor: %s (code: %d)\n", err->message, err->code);
533535 &key_size, /* Output key size * /
534536 &value, /* Output value * /
535537 &value_size /* Output value size * /
536- );
538+ ); / * or tidesdb_merge_cursor_get * /
537539
538540 if (err != NULL) {
539541 printf("Error getting cursor value: %s (code: %d)\n", err->message, err->code);
546548 /* Free the key and value when done to prevent memory leaks * /
547549 free (key);
548550 free (value);
549- } while ((err = tidesdb_cursor_next(cursor)) == NULL );
551+ } while ((err = tidesdb_cursor_next(cursor)) == NULL ); /* or tidesdb_merge_cursor_next */
550552
551553/*
552554* Check if we reached the end of the cursor or if there was an error
569571 &key_size, /* Output key size */
570572 &value, /* Output value */
571573 &value_size /* Output value size */
572- );
574+ ); /* or tidesdb_merge_cursor_get */
573575
574576 if (err != NULL) {
575577 printf ("Error getting cursor value: %s (code: %d)\n", err->message, err->code);
582584 /* Free the key and value when done * /
583585 free(key);
584586 free(value);
585- } while ((err = tidesdb_cursor_prev(cursor)) == NULL );
587+ } while ((err = tidesdb_cursor_prev(cursor)) == NULL ); /* or tidesdb_merge_cursor_prev */
586588
587589/* Check if we reached the start of the cursor or if there was an error */
588590if (err != NULL && err->code != TIDESDB_ERR_AT_START_OF_CURSOR) {
@@ -593,7 +595,7 @@ if (err != NULL && err->code != TIDESDB_ERR_AT_START_OF_CURSOR) {
593595
594596#### Freeing a Cursor
595597``` c
596- tidesdb_cursor_free (cursor);
598+ tidesdb_cursor_free (cursor); / * or tidesdb_merge_cursor_free
597599```
598600
599601### Compaction Operations
0 commit comments