https://github.com/letterbeezps/pickledb
PickleDB-go is a lightweight and simple key-value store. It is a Golang version for Python's PickleDB
https://github.com/letterbeezps/pickledb
go pickle pickledb-go
Last synced: 5 months ago
JSON representation
PickleDB-go is a lightweight and simple key-value store. It is a Golang version for Python's PickleDB
- Host: GitHub
- URL: https://github.com/letterbeezps/pickledb
- Owner: letterbeezps
- Created: 2021-11-21T15:49:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-08-14T03:05:21.000Z (almost 4 years ago)
- Last Synced: 2024-06-20T06:32:32.998Z (almost 2 years ago)
- Topics: go, pickle, pickledb-go
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PickleDB-go
A lightweight and simple key-value store written in Go, inspired by [Python's PickleDB](https://github.com/patx/pickledb) and [PickleDB-rs](https://github.com/seladb/pickledb-rs).
When I used go to refactor the python project of my former colleague, I tried to find an alternative to [pickleDB](https://github.com/patx/pickledb) in [go.dev](https://pkg.go.dev/), but it failed. Fortunately, the source code of [pickleDB](https://github.com/patx/pickledb) is not complicated, so I try to develop a pickleDB-go by myself.
The core of the project is to user map[string]interface{} represent arbitray data.
## exmaple
```go
package main
import (
"fmt"
"github.com/letterbeezps/pickledb"
)
func main() {
Dump()
Load()
}
func Dump() {
db := pickledb.Load("test.db", false)
db.Set("letter", "letter_value")
db.Dump()
}
func Load() {
db := pickledb.Load("test.db", false)
v, _ := db.Get("letter")
fmt.Println(v)
}
```
```shell
go run main.go
```
Create test.db in the current folder