diff options
Diffstat (limited to 'memory_database.go')
-rw-r--r-- | memory_database.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/memory_database.go b/memory_database.go new file mode 100644 index 000000000..fc40f76f3 --- /dev/null +++ b/memory_database.go @@ -0,0 +1,25 @@ +package main + +import ( +) + +/* + * This is a test memory database. Do not use for any production it does not get persisted + */ +type MemDatabase struct { + db map[string][]byte +} + +func NewMemDatabase() (*MemDatabase, error) { + db := &MemDatabase{db: make(map[string][]byte)} + + return db, nil +} + +func (db *MemDatabase) Put(key []byte, value []byte) { + db.db[string(key)] = value +} + +func (db *MemDatabase) Get(key []byte) ([]byte, error) { + return db.db[string(key)], nil +} |