<commit_before>package main

import (
  "fmt"
  "runtime"

  "github.com/jmhodges/levigo"

  lns "github.com/abhishekkr/levigoNS"
  abkleveldb "github.com/abhishekkr/levigoNS/leveldb"
)

func Read(key string, db *levigo.DB) string{
  val := abkleveldb.GetValues(key, db)
  return val
}

func ExampleNS(db *levigo.DB) {
  runtime.GOMAXPROCS(runtime.NumCPU())

  fmt.Println("add some data first for a,a:1,a:2,a:1:2,a:2:1,a:3,a:1:1 ~")
  lns.PushNS("a", "A", db)
  lns.PushNS("a:1", "A1", db)
  lns.PushNS("a:2", "A2", db)
  lns.PushNS("a:1:2", "A12", db)
  lns.PushNS("a:2:1", "A21", db)
  lns.PushNS("a:3", "A3", db)
  lns.PushNS("a:1:1", "A11", db)
  lns.PushNS("b:2:1", "A11", db)

  fmt.Println("read some data now ~")
  Read("val::a", db)
  Read("val::a:1", db)
  Read("val::a:2", db)
  Read("val::a:1:2", db)
  Read("val::a:2:1", db)
  Read("val::a:3", db)
  Read("val::a:1:1", db)

  fmt.Println("super keys~")
  Read("key::a", db)
  Read("key::a:1", db)
  Read("key::a:2", db)
  Read("key::b", db)
  Read("key::b:2", db)

  var hmap map[string]string
  hmap = make(map[string]string)
  hmap = lns.ReadNS("key::a", db)
  for k,v := range hmap {
    fmt.Printf("%s => %s\n", k, v)
  }
  hmap = lns.ReadNS("key::c", db)
  for k,v := range hmap {
    fmt.Printf("%s => %s", k, v)
  }
}

func main(){
  var db *levigo.DB
  db = abkleveldb.CreateDB("/tmp/LevelDB02")
  ExampleNS(db)
}<commit_msg>spike example updated with DeleteNS and DeleteNSRecursive usage<commit_after>package main

import (
  "fmt"
  "runtime"

  "github.com/jmhodges/levigo"

  lns "github.com/abhishekkr/levigoNS"
  abkleveldb "github.com/abhishekkr/levigoNS/leveldb"
)


var (
  separator = ":"
)

func Read(key string, db *levigo.DB) string{
  val := abkleveldb.GetVal(key, db)
  fmt.Printf("for %s get %s\n", key, val)
  return val
}

func ExampleNS(db *levigo.DB) {
  runtime.GOMAXPROCS(runtime.NumCPU())

  fmt.Println("add some data first for a,a:1,a:2,a:1:2,a:2:1,a:3,a:1:1 ~")
  lns.PushNS("a", "A", db)
  lns.PushNS("a:1", "A1", db)
  lns.PushNS("a:2", "A2", db)
  lns.PushNS("a:1:2", "A12", db)
  lns.PushNS("a:2:1", "A21", db)
  lns.PushNS("a:3", "A3", db)
  lns.PushNS("a:1:1", "A11", db)
  lns.PushNS("b:2:1", "A11", db)

  fmt.Println("read some data now ~")
  Read("val::a", db)
  Read("val::a:1", db)
  Read("val::a:2", db)
  Read("val::a:1:2", db)
  Read("val::a:2:1", db)
  Read("val::a:3", db)
  Read("val::a:1:1", db)

  fmt.Println("super keys~")
  Read("key::a", db)
  Read("key::a:1", db)
  Read("key::a:2", db)
  Read("key::b", db)
  Read("key::b:2", db)

  var hmap map[string]string
  hmap = make(map[string]string)
  hmap = lns.ReadNS("key::a", db)
  for k,v := range hmap {
    fmt.Printf("%s => %s\n", k, v)
  }
  hmap = lns.ReadNS("key::c", db)
  for k,v := range hmap {
    fmt.Printf("%s => %s", k, v)
  }

  fmt.Println("read/delete~")
  fmt.Printf("Recursive under a: %v\n", lns.ReadNSRecursive("a", db))
  fmt.Println("before del a:1:2 ~ ", abkleveldb.GetVal("key::a:1", db) )
  lns.DeleteNS("a:1:2", db)
  fmt.Println("after del of a:1:2 ~ ", abkleveldb.GetVal("key::a:1", db) )
  fmt.Printf("Recursive under a: %v\n", lns.ReadNSRecursive("a", db))
  fmt.Println("before del a ~ ", abkleveldb.GetVal("key::a", db) )
  lns.DeleteNSRecursive("a", db)
  fmt.Println("after del a ~ ", abkleveldb.GetVal("key::a", db) )
  fmt.Printf("Recursive under a: %v\n", lns.ReadNSRecursive("a", db))
  fmt.Printf("Recursive under b: %v\n", lns.ReadNSRecursive("b", db))
  fmt.Println("before del of b ~",  abkleveldb.GetVal("key::b", db) )
  lns.DeleteNS("b", db)
  fmt.Println("after del of b ~ ", abkleveldb.GetVal("key::b", db) )
  fmt.Println("after del b:2 ~ ", abkleveldb.GetVal("key::b:2", db) )
  fmt.Println("after del b:2:1 ~ ", abkleveldb.GetVal("key::b:2:1", db) )
  fmt.Printf("Recursive under b: %v\n", lns.ReadNSRecursive("b", db))
}

func main(){
  var db *levigo.DB
  db = abkleveldb.CreateDB("/tmp/LevelDB02")
  ExampleNS(db)
}
{'fraction_non_alphanumeric': 0.23395077391524993, 'fraction_numerical': 0.026389241309312358, 'mean_word_length': 4.207397622192866, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2327016', 'n_tokens_mistral': 1867, 'n_tokens_neox': 1850, 'n_words': 335}