Skip to content

tbeets/nats-kv-101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nats-kv-101

Basic kick the tires on NATS Key-Value API (Go)

Usage

# Get
./mybucket -s "nats://vbox1.tinghus.net" -creds "/home/todd/lab/nats-cluster1/vault/.nkeys/creds/NatsOp/AcctA/UserA1.creds" bucket1 foo

# Put
./mybucket -s "nats://vbox1.tinghus.net" -creds "/home/todd/lab/nats-cluster1/vault/.nkeys/creds/NatsOp/AcctA/UserA1.creds" bucket1 foo bar

# Get with history
./mybucket -s "nats://vbox1.tinghus.net" -creds "/home/todd/lab/nats-cluster1/vault/.nkeys/creds/NatsOp/AcctA/UserA1.creds" --history bucket1 foo

# Watch
./mywatch -s "nats://vbox1.tinghus.net" -creds "/home/todd/lab/nats-cluster1/vault/.nkeys/creds/NatsOp/AcctA/UserA1.creds" bucket1 foo

API Notes

kv, err := js.KeyValue("bucket name")
Type Methods
KeyValue Bucket, Delete, Create, Update, Put, Get, Status, History, Keys, Purge, PurgeAll, Watch, WatchAll
KeyValueEntry Key, Value, Revision, Operation, Delta, Bucket, Created
Status Values, TTL, History, Bucket, BackingStore, StreamInfo (when cast to *nats.keyValueBucketStatus)
KeyWatcher Stop, Updates

Notes:

  • A watcher (via Updates) initially returns the current KeyValueEntry (if any) then a nil KeyValueEntry. Subsequent entries represent changes since watcher instantiated.

Resources

About

Basic kick the tires on NATS Key-Value API (Go)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages