mirror of
https://github.com/apple/foundationdb.git
synced 2025-06-02 19:25:52 +08:00
go: Implment Stringer interface for DirectorySubspace
This commit is contained in:
parent
e592901551
commit
22fa93264f
@ -23,6 +23,8 @@
|
||||
package directory
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"github.com/apple/foundationdb/bindings/go/src/fdb"
|
||||
"github.com/apple/foundationdb/bindings/go/src/fdb/subspace"
|
||||
)
|
||||
@ -43,6 +45,18 @@ type directorySubspace struct {
|
||||
layer []byte
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer interface and returns human-readable
|
||||
// string representation of this object.
|
||||
func (ds directorySubspace) String() string {
|
||||
var path string
|
||||
if len(ds.path) > 0 {
|
||||
path = "(" + strings.Join(ds.path, ",") + ")"
|
||||
} else {
|
||||
path = "nil"
|
||||
}
|
||||
return fmt.Sprintf("DirectorySubspace(%s, %s)", path, fdb.Printable(ds.Bytes()))
|
||||
}
|
||||
|
||||
func (d directorySubspace) CreateOrOpen(t fdb.Transactor, path []string, layer []byte) (DirectorySubspace, error) {
|
||||
return d.dl.CreateOrOpen(t, d.dl.partitionSubpath(d.path, path), layer)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user