Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xyproto/simplebolt
:nut_and_bolt: Simple way to use the Bolt database
https://github.com/xyproto/simplebolt
bolt bolt-database boltdb go strings
Last synced: 12 days ago
JSON representation
:nut_and_bolt: Simple way to use the Bolt database
- Host: GitHub
- URL: https://github.com/xyproto/simplebolt
- Owner: xyproto
- License: bsd-3-clause
- Created: 2015-05-21T12:23:40.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2023-06-30T12:32:24.000Z (over 1 year ago)
- Last Synced: 2024-10-19T05:22:06.918Z (25 days ago)
- Topics: bolt, bolt-database, boltdb, go, strings
- Language: Go
- Homepage:
- Size: 3.61 MB
- Stars: 67
- Watchers: 7
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple Bolt ![Build](https://github.com/xyproto/simplebolt/workflows/Build/badge.svg) [![GoDoc](https://godoc.org/github.com/xyproto/simplebolt?status.svg)](http://godoc.org/github.com/xyproto/simplebolt) [![Go Report Card](https://goreportcard.com/badge/github.com/xyproto/simplebolt)](https://goreportcard.com/report/github.com/xyproto/simplebolt) [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/xyproto/simplebolt/main/LICENSE)
Simple way to use the [Bolt](https://github.com/coreos/bbolt) database. Similar design to [simpleredis](https://github.com/xyproto/simpleredis).
## Features and limitations
* Supports simple use of lists, hashmaps, sets and key/values.
* Deals mainly with strings.
* Requires Go 1.17 or later.
* Note that `HashMap` is implemented only for API-compatibility with [simpleredis](https://github.com/xyproto/simpleredis), and does not have the same performance profile as the `HashMap` implementation in [simpleredis](https://github.com/xyproto/simpleredis), [simplemaria](https://github.com/xyproto/simplemaria) (MariaDB/MySQL) or [simplehstore](https://github.com/xyproto/simplehstore) (PostgreSQL w/ HSTORE).## Example usage
~~~go
package mainimport (
"log""github.com/xyproto/simplebolt"
)func main() {
// New bolt database struct
db, err := simplebolt.New("bolt.db")
if err != nil {
log.Fatalf("Could not create database! %s", err)
}
defer db.Close()// Create a list named "greetings"
list, err := simplebolt.NewList(db, "greetings")
if err != nil {
log.Fatalf("Could not create a list! %s", err)
}// Add "hello" to the list
if err := list.Add("hello"); err != nil {
log.Fatalf("Could not add an item to the list! %s", err)
}// Get the last item of the list
if item, err := list.Last(); err != nil {
log.Fatalf("Could not fetch the last item from the list! %s", err)
} else {
log.Println("The value of the stored item is:", item)
}// Remove the list
if err := list.Remove(); err != nil {
log.Fatalf("Could not remove the list! %s", err)
}
}
~~~## Contributors
* Luis Villegas, for the linked list functionality.
## Version, license and author
* License: BSD-3
* Version: 5.2.1
* Author: Alexander F. Rødseth <[email protected]>