From d68f7a22629b94b5ff7f939fb70da0bfd2efa08c Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Thu, 5 Jun 2014 18:03:02 -0700 Subject: [PATCH] whitespaces --- db/level_db.go | 46 +++++++++++++++++++++++----------------------- db/mem_db.go | 14 +++++++------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/db/level_db.go b/db/level_db.go index b2346130b..48e14a4a1 100644 --- a/db/level_db.go +++ b/db/level_db.go @@ -1,54 +1,54 @@ package db import ( - "fmt" - "github.com/syndtr/goleveldb/leveldb" - "path" + "fmt" + "github.com/syndtr/goleveldb/leveldb" + "path" ) type LevelDB struct { - db *leveldb.DB + db *leveldb.DB } func NewLevelDB(name string) (*LevelDB, error) { - dbPath := path.Join(name) - db, err := leveldb.OpenFile(dbPath, nil) - if err != nil { - return nil, err - } - database := &LevelDB{db: db} - return database, nil + dbPath := path.Join(name) + db, err := leveldb.OpenFile(dbPath, nil) + if err != nil { + return nil, err + } + database := &LevelDB{db: db} + return database, nil } func (db *LevelDB) Put(key []byte, value []byte) { - err := db.db.Put(key, value, nil) - if err != nil { panic(err) } + err := db.db.Put(key, value, nil) + if err != nil { panic(err) } } func (db *LevelDB) Get(key []byte) ([]byte) { - res, err := db.db.Get(key, nil) + res, err := db.db.Get(key, nil) if err != nil { panic(err) } return res } func (db *LevelDB) Delete(key []byte) { - err := db.db.Delete(key, nil) + err := db.db.Delete(key, nil) if err != nil { panic(err) } } func (db *LevelDB) Db() *leveldb.DB { - return db.db + return db.db } func (db *LevelDB) Close() { - db.db.Close() + db.db.Close() } func (db *LevelDB) Print() { - iter := db.db.NewIterator(nil, nil) - for iter.Next() { - key := iter.Key() - value := iter.Value() - fmt.Printf("[%x]:\t[%x]", key, value) - } + iter := db.db.NewIterator(nil, nil) + for iter.Next() { + key := iter.Key() + value := iter.Value() + fmt.Printf("[%x]:\t[%x]", key, value) + } } diff --git a/db/mem_db.go b/db/mem_db.go index 9a84882e0..9cde27547 100644 --- a/db/mem_db.go +++ b/db/mem_db.go @@ -1,7 +1,7 @@ package db import ( - "fmt" + "fmt" ) type MemDB struct { @@ -9,8 +9,8 @@ type MemDB struct { } func NewMemDB() (*MemDB) { - database := &MemDB{db:make(map[string][]byte)} - return database + database := &MemDB{db:make(map[string][]byte)} + return database } func (db *MemDB) Put(key []byte, value []byte) { @@ -22,11 +22,11 @@ func (db *MemDB) Get(key []byte) ([]byte) { } func (db *MemDB) Delete(key []byte) { - delete(db.db, string(key)) + delete(db.db, string(key)) } func (db *MemDB) Print() { - for key, value := range db.db { - fmt.Printf("[%x]:\t[%x]", []byte(key), value) - } + for key, value := range db.db { + fmt.Printf("[%x]:\t[%x]", []byte(key), value) + } }