Skip to content

AmirSoleimani/MemoryDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

MemoryDB


Interfaces

  • NewMemDB
  • NewMemDBWithCap
  • Put
  • Get
  • Has
  • Keys
  • Delete
  • Batch -- Put -- Delete

Installation

Just use go get.

    go get github.com/AmirSoleimani/MemoryDB/memdb

Sample

func main() {
    	// sample
    	memDB := db.NewMemDB()
    	memDB.Put([]byte("blabla"), []byte("gogogo"))
    
    	a, _ := memDB.Get([]byte("blabla"))
    	fmt.Println(string(a))
    
    	batch := memDB.NewBatch()
    	batch.Put([]byte("1111"), []byte("aaaaaa"))
    	batch.Put([]byte("2222"), []byte("bbbbb"))
    	batch.Delete([]byte("blabla"))
    	batch.Write()
    
    	fmt.Println(memDB.Keys())
}

Releases

No releases published

Packages

No packages published

Languages