Skip to content

haibeey/doclite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doclite

Doclite is a light-weight document base database libary much like how SQLite is for SQL so is how doclite is to NoSQL.

Doclite provide a nice and simple Api to persist document base data types/structures on disks.

Code Samples

A Golang example below have a look at the example folder for other languages
 type Employer struct {
  	Name    string
  	Address string
  }

  db := doclite.Connect("example.doclite") // opens a new or existing database 

  baseCollection := db.Base() // get the root of the database
  // insert 20 documnets element
  for i := 0; i < 20; i++ {
  e := &Employer{Name: fmt.Sprintf("%d docklite", i), Address: "doe"}
  baseCollection.Insert(e)
  }

  // get the 14th document inserted
  e := &Employer{}
  baseCollection.FindOne(14, e)
  fmt.Println(e)

  // delete document with id 16
  baseCollection.DeleteOne(16)

  e = &Employer{}
  // get the 17 document inserted
  baseCollection.FindOne(17, e)
  fmt.Println(e)

  e=&Employer{}
  joe:=&Employer{Address:"doe"}
  // find all document matching the joe
  cur:=baseCollection.Find(joe,e)
  for {
  	emp:=cur.Next()
  	if emp==nil{
  		break
  	}
  	fmt.Println(emp)
  }
  db.Close() // close the database

More info can be found https://godoc.org/github.com/haibeey/doclite

Contributions are welcome

Shared library

Doclite can be used with multiple programming langauges by building a shared library built on the platform specific machine using the go command go build -o docliteshared.so -buildmode=c-shared docliteexport.go. docliteexport.go can be found in the sharedlib directory. An example usage for python can found in the examples directories. more details on the python package can be found https://pypi.org/project/pydoclite/

About

No sql no server database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published