File: common.go

package info (click to toggle)
mongo-tools 3.4.14-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,612 kB
  • sloc: python: 9,281; asm: 4,229; ansic: 1,606; sh: 817; makefile: 67; cpp: 59; lisp: 19
file content (16 lines) | stat: -rw-r--r-- 337 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
}