diff options
Diffstat (limited to 'src/mongo/gotools/common/common.go')
-rw-r--r-- | src/mongo/gotools/common/common.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/gotools/common/common.go b/src/mongo/gotools/common/common.go new file mode 100644 index 00000000000..f2922d806d8 --- /dev/null +++ b/src/mongo/gotools/common/common.go @@ -0,0 +1,16 @@ +// Package common contains subpackages that are shared amongst the mongo +// tools. +package common + +import ( + "strings" +) + +// SplitNamespace returns the db and column from a single namespace string. +func SplitNamespace(ns string) (string, string) { + i := strings.Index(ns, ".") + if i != -1 { + return ns[:i], ns[i+1:] + } + return "", ns +} |