Skip to content

TinyDB is a lightweight document oriented database optimized for your happiness :)

License

Notifications You must be signed in to change notification settings

kanrichan/tinydb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinydb

Introduction

TinyDB is a lightweight document oriented database optimized for your happiness :) The target are small apps that would be blown away by a SQL-DB or an external database server.

But in this project, it's written in pure Golang and has no external dependencies.

Example Code

Import

import tiny "github.com/Yiwen-Chan/tinydb"

New a storage

storage, err := tiny.JSONStorage("test.json")

Open a database used by storage

database, err := tiny.TinyDB(storage)
defer database.Close()

Get a table and Insert or Delete or Update or Select

table := tiny.GetTable[student](database)
table.Insert(student{001, "test"})
table.Update(func(s student) student { s.ID = 002; return s }, func(s student) bool { return true })
table.Select(func(s student) bool { return true })
table.Delete(func(s student) bool { return true })

About

TinyDB is a lightweight document oriented database optimized for your happiness :)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages