Skip to content

Commit

Permalink
fix for console pointer Paginator
Browse files Browse the repository at this point in the history
  • Loading branch information
rif committed Aug 5, 2015
1 parent 5e3163f commit 7dec806
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion console/command_executer.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,17 @@ func (ce *CommandExecuter) clientArgs(iface interface{}) (args []string) {
for i := 0; i < typ.NumField(); i++ {
valField := val.Field(i)
typeField := typ.Field(i)
//log.Printf("%v (%v)", typeField.Name, valField.Kind())
switch valField.Kind() {
case reflect.Struct:
case reflect.Ptr, reflect.Struct:
if valField.Kind() == reflect.Ptr {
valField = reflect.New(valField.Type().Elem()).Elem()
if valField.Kind() != reflect.Struct {
//log.Printf("Here: %v (%v)", typeField.Name, valField.Kind())
args = append(args, typeField.Name)
continue
}
}
args = append(args, ce.clientArgs(valField.Interface())...)
default:
args = append(args, typeField.Name)
Expand Down
5 changes: 3 additions & 2 deletions console/lcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ package console

import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)

func init() {
c := &CmdGetLcr{
name: "lcr",
rpcMethod: "ApierV1.GetLcr",
rpcParams: &engine.LcrRequest{},
rpcParams: &engine.LcrRequest{Paginator: &utils.Paginator{}},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
Expand All @@ -50,7 +51,7 @@ func (self *CmdGetLcr) RpcMethod() string {

func (self *CmdGetLcr) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.LcrRequest{}
self.rpcParams = &engine.LcrRequest{Paginator: &utils.Paginator{}}
}
return self.rpcParams
}
Expand Down

0 comments on commit 7dec806

Please sign in to comment.