Code Review
/
ric-plt
/
sdlgo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "RIC:1060: Change in PTL"
[ric-plt/sdlgo.git]
/
internal
/
cli
/
types.go
diff --git
a/internal/cli/types.go
b/internal/cli/types.go
index
eb86905
..
4b50964
100644
(file)
--- a/
internal/cli/types.go
+++ b/
internal/cli/types.go
@@
-22,7
+22,11
@@
package cli
package cli
-import "gerrit.o-ran-sc.org/r/ric-plt/sdlgo/internal/sdlgoredis"
+import (
+ "fmt"
+ "gerrit.o-ran-sc.org/r/ric-plt/sdlgo/internal/sdlgoredis"
+ "strings"
+)
//iDatabase is an interface towards database backend, for the time being
//sdlgoredis.DB implements this interface.
//iDatabase is an interface towards database backend, for the time being
//sdlgoredis.DB implements this interface.
@@
-30,6
+34,7
@@
type iDatabase interface {
Info() (*sdlgoredis.DbInfo, error)
State() (*sdlgoredis.DbState, error)
Keys(pattern string) ([]string, error)
Info() (*sdlgoredis.DbInfo, error)
State() (*sdlgoredis.DbState, error)
Keys(pattern string) ([]string, error)
+ Statistics() (*sdlgoredis.DbStatistics, error)
}
//Database struct is a holder for the internal database instances.
}
//Database struct is a holder for the internal database instances.
@@
-57,14
+62,22
@@
type keysArgs struct {
pattern string
}
pattern string
}
-//
n
ewKeysArgs constructs a new keysArgs struct.
-func
n
ewKeysArgs(ns string, pattern string) keysArgs {
+//
N
ewKeysArgs constructs a new keysArgs struct.
+func
N
ewKeysArgs(ns string, pattern string) keysArgs {
return keysArgs{
ns: ns,
pattern: pattern,
}
}
return keysArgs{
ns: ns,
pattern: pattern,
}
}
+//Validate command arguments in keysArgs.
+func (k keysArgs) Validate() error {
+ if strings.Contains(k.ns, "*") {
+ return fmt.Errorf("Invalid character (*) in given %s namespace argument.", k.ns)
+ }
+ return nil
+}
+
//nsMap is a map having SDL DB cluster address as a key and namespace map of type nsKeyMap as a value
type nsMap map[string]nsKeyMap
//nsMap is a map having SDL DB cluster address as a key and namespace map of type nsKeyMap as a value
type nsMap map[string]nsKeyMap