Skip to content

A lightweight, persistent, NoSQL database written in Go.

License

Notifications You must be signed in to change notification settings

billykirk01/AlgoeDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AlgoeDB

A lightweight, persistent, NoSQL database written in Go.

Inspired by the Deno project AloeDB. Many thanks to @Kirlovon for the inspiration!

Features

  • 🎉 Simple to use API, similar to MongoDB!
  • 📁 Stores data in readable JSON file.
  • 🚀 Optimized for a large number of operations.
  • ⚖ No dependencies outside of the standard library.

Examples Usage

type People []map[string]interface{}

type Person map[string]interface{}

func main() {
	config := AlgoeDB.DatabaseConfig{Path: "./people.json"}
	db, err := AlgoeDB.NewDatabase(&config)
	if err != nil {
		log.Fatal(err)
	}

	people := People{}
	people = append(people, Person{"name": "Billy", "age": 27})
	people = append(people, Person{"name": "Carisa", "age": 26})

	err = db.InsertMany(people)
	if err != nil {
		log.Fatal(err)
	}

	query := Person{"name": "Carisa"}
	result := db.FindOne(query)

	if result != nil {
		fmt.Println("results:", result) //result: [map[age:26 name:Carisa]]
	} else {
		fmt.Println("no documents found")
	}

	query = Person{"age": AlgoeDB.MoreThan(25)}
	results := db.FindMany(query)

	if results != nil {
		fmt.Println("results:", results) //results: [map[age:27 name:Billy] map[age:26 name:Carisa]]
	} else {
		fmt.Println("no documents found")
	}
}

About

A lightweight, persistent, NoSQL database written in Go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages