Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-simple-memdb GoDoc

GitHub license Build Status codecov.io Go Report Card

forthebadge

Simple in-memory database written in Go.

WARNING - this is just an example - unusable for production!

Get/Set concurrency locks aren't there yet.

Requirements

Golang compiler and tools (v1.5 or later) are required. See the official Getting Started guide or your distro's docs for detailed instructions.

Installation

go get -u github.com/utrack/go-simple-memdb

If you're using Go < 1.6 - you need to set envvar GO15VENDOREXPERIMENT to 1 before go-getting:

GO15VENDOREXPERIMENT=1 go get -u github.com/utrack/go-simple-memdb

Running

Check that your PATH envvar has $GOPATH\bin and run the command:

go-simple-memdb

Protocol definition

Data

  • SET <name <value> – Sets the variable name to the value value. Variable name should not contain spaces.
  • GET <name> – Value of the variable name is returned. NULL is returned if that variable was not set before.
  • UNSET <name> – Unsets the variable name, making it just like that variable was never set.
  • NUMEQUALTO <value> – Number of variables that are currently set to value is returned.
  • END – Exit the program.

Transactions

This storage supports nested transactions.

  • BEGIN – Open a new transaction block. Transaction blocks can be nested; a BEGIN can be issued inside of an existing block.
  • ROLLBACK – Most recent transaction block is closed, all changes in it are forgotten. NO TRANSACTION is printed if there's no transactions in progress.
  • COMMIT – Closes all open transaction blocks, permanently applying the changes made in them. NO TRANSACTION is printed if there's no transactions in progress.

Any data command that is run outside of a transaction block is committed immediately.

Testing

go test github.com/utrack/go-simple-memdb/...

Tests are using the GoConvey framework. If you have goconvey tools installed in your $PATH, run goconvey github.com/utrack/go-simple-memdb/... to use its web interface.

About

Simple in-memory database written in Go

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages