-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
214 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v.0.0.1 | ||
v.0.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
package database | ||
|
||
import "errors" | ||
|
||
const ( | ||
// BOLT_DB - BoltDB | ||
BOLT_DB = "boltdb" | ||
// BUNT_DB - BuntDB | ||
BUNT_DB = "buntdb" | ||
) | ||
|
||
type KeyValuePair struct { | ||
Key string | ||
Value string | ||
} | ||
|
||
// DB interface for underlying database packages | ||
type DB interface { | ||
Add(string, string, ...interface{}) error | ||
CloseDB() | ||
Get(key string) (string, error) // TODO: add list all keys | ||
Delete(string) error | ||
List(args ...interface{}) ([]KeyValuePair, error) | ||
} | ||
|
||
// Buckets interface for underlying bolt DB buckets | ||
type Buckets interface { | ||
Add() | ||
Get() | ||
List() | ||
Delete() | ||
} | ||
|
||
// DBType for identifying underlying database packages | ||
type DBType string | ||
|
||
// NewDB godoc - creates a new DB instance abstracting the underlying database package | ||
func NewDB(fileName string, dbtype string) (DB, error) { | ||
|
||
// TODO: Add support for other database packages | ||
switch dbtype { | ||
case BOLT_DB: | ||
return openBolt(fileName) | ||
case BUNT_DB: | ||
return openBunt(fileName) | ||
default: | ||
return nil, errors.New("invalid database type") | ||
} | ||
} | ||
package database | ||
|
||
import "errors" | ||
|
||
const ( | ||
// BOLT_DB - BoltDB | ||
BOLT_DB = "boltdb" | ||
// BUNT_DB - BuntDB | ||
BUNT_DB = "buntdb" | ||
) | ||
|
||
type KeyValuePair struct { | ||
Key string | ||
Value string | ||
} | ||
|
||
// DB interface for underlying database packages | ||
type DB interface { | ||
Add(string, string, ...interface{}) error | ||
CloseDB() | ||
Get(key string) (string, error) // TODO: add list all keys | ||
Delete(string) error | ||
List(args ...interface{}) ([]KeyValuePair, error) | ||
} | ||
|
||
// Buckets interface for underlying bolt DB buckets | ||
type Buckets interface { | ||
Add() | ||
Get() | ||
List() | ||
Delete() | ||
} | ||
|
||
// DBType for identifying underlying database packages | ||
type DBType string | ||
|
||
// NewDB godoc - creates a new DB instance abstracting the underlying database package | ||
func NewDB(fileName string, dbtype string) (DB, error) { | ||
|
||
// TODO: Add support for other database packages | ||
switch dbtype { | ||
case BOLT_DB: | ||
return openBolt(fileName) | ||
case BUNT_DB: | ||
return openBunt(fileName) | ||
default: | ||
return nil, errors.New("invalid database type") | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,5 +53,6 @@ | |
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
} | ||
}, | ||
"proxy": "http://127.0.0.1:8080" | ||
} |
Oops, something went wrong.