mirror of https://github.com/etcd-io/bbolt.git
Add Stringer support.
parent
d1952237ed
commit
6a7be8879b
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@ BENCH=.
|
|||
COVERPROFILE=/tmp/c.out
|
||||
|
||||
bench: benchpreq
|
||||
go test -v -test.bench=$(BENCH) ./.bench
|
||||
go test -v -test.bench=$(BENCH)
|
||||
|
||||
cover: fmt
|
||||
go test -coverprofile=$(COVERPROFILE) -test.run=$(TEST) .
|
||||
|
|
11
db.go
11
db.go
|
@ -1,6 +1,7 @@
|
|||
package bolt
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"sync"
|
||||
|
@ -42,6 +43,16 @@ func (db *DB) Path() string {
|
|||
return db.path
|
||||
}
|
||||
|
||||
// GoString returns the Go string representation of the database.
|
||||
func (db *DB) GoString() string {
|
||||
return fmt.Sprintf("bolt.DB{path:%q}", db.path)
|
||||
}
|
||||
|
||||
// String returns the string representation of the database.
|
||||
func (db *DB) String() string {
|
||||
return fmt.Sprintf("DB<%q>", db.path)
|
||||
}
|
||||
|
||||
// Open opens a data file at the given path and initializes the database.
|
||||
// If the file does not exist then it will be created automatically.
|
||||
func (db *DB) Open(path string, mode os.FileMode) error {
|
||||
|
|
Loading…
Reference in New Issue