在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:sdomino/scribble开源软件地址:https://github.com/sdomino/scribble开源编程语言:Go 100.0%开源软件介绍:ScribbleA tiny JSON database in Golang InstallationInstall using Usage// a new scribble driver, providing the directory where it will be writing to,
// and a qualified logger if desired
db, err := scribble.New(dir, nil)
if err != nil {
fmt.Println("Error", err)
}
// Write a fish to the database
fish := Fish{}
if err := db.Write("fish", "onefish", fish); err != nil {
fmt.Println("Error", err)
}
// Read a fish from the database (passing fish by reference)
onefish := Fish{}
if err := db.Read("fish", "onefish", &onefish); err != nil {
fmt.Println("Error", err)
}
// Read all fish from the database, unmarshaling the response.
records, err := db.ReadAll("fish")
if err != nil {
fmt.Println("Error", err)
}
fishies := []Fish{}
for _, f := range records {
fishFound := Fish{}
if err := json.Unmarshal([]byte(f), &fishFound); err != nil {
fmt.Println("Error", err)
}
fishies = append(fishies, fishFound)
}
// Delete a fish from the database
if err := db.Delete("fish", "onefish"); err != nil {
fmt.Println("Error", err)
}
// Delete all fish from the database
if err := db.Delete("fish", ""); err != nil {
fmt.Println("Error", err)
} DocumentationTodo/Doing
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论