New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/xyproto/simplebolt

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/xyproto/simplebolt

  • v1.5.2
  • Source
  • Go
  • Socket score

Version published
Created
Source

Simple Bolt

Build GoDoc Go Report Card License

Simple way to use the Bolt database. Similar design to simpleredis.

Online API Documentation

godoc.org

Features and limitations

  • Supports simple use of lists, hashmaps, sets and key/values.
  • Deals mainly with strings.
  • Requires Go 1.9 or later.
  • Note that HashMap is implemented only for API-compatibility with simpleredis, and does not have the same performance profile as the HashMap implementation in simpleredis, simplemaria (MariaDB/MySQL) or simplehstore (PostgreSQL w/ HSTORE).

Example usage

package main

import (
    "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

FAQs

Package last updated on 25 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc