diff options
Diffstat (limited to 'vendor/gitea.com/lunny/levelqueue/README.md')
-rw-r--r-- | vendor/gitea.com/lunny/levelqueue/README.md | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/vendor/gitea.com/lunny/levelqueue/README.md b/vendor/gitea.com/lunny/levelqueue/README.md index 80a0853cf6..21db280839 100644 --- a/vendor/gitea.com/lunny/levelqueue/README.md +++ b/vendor/gitea.com/lunny/levelqueue/README.md @@ -25,4 +25,36 @@ data, err = queue.LPop() queue.LHandle(func(dt []byte) error{ return nil }) -```
\ No newline at end of file +``` + +You can now create a Set from a leveldb: + +```Go +set, err := levelqueue.OpenSet("./set") + +added, err:= set.Add([]byte("member1")) + +has, err := set.Has([]byte("member1")) + +members, err := set.Members() + +removed, err := set.Remove([]byte("member1")) +``` + +And you can create a UniqueQueue from a leveldb: + +```Go +queue, err := levelqueue.OpenUnique("./queue") + +err := queue.RPush([]byte("member1")) + +err = queue.LPush([]byte("member1")) +// Will return ErrAlreadyInQueue + +// and so on. +``` + +## Creating Queues, UniqueQueues and Sets from already open DB + +If you have an already open DB you can create these from this using the +`NewQueue`, `NewUniqueQueue` and `NewSet` functions.
\ No newline at end of file |