no more reflection

This commit is contained in:
Radu Ioan Fericean
2012-10-01 13:07:07 +03:00
parent 7dd14f9038
commit 9349c27f76
6 changed files with 43 additions and 50 deletions

View File

@@ -21,18 +21,17 @@ package main
import (
"flag"
"fmt"
"github.com/cgrates/cgrates/console"
"github.com/cgrates/cgrates/timespans"
"log"
"net/rpc"
"net/rpc/jsonrpc"
"os"
"reflect"
"github.com/cgrates/cgrates/timespans"
"github.com/cgrates/cgrates/console"
)
var (
version = flag.Bool("version", false, "Prints the application version.")
server = flag.String("server", "127.0.0.1:2000", "server address host:port")
version = flag.Bool("version", false, "Prints the application version.")
server = flag.String("server", "127.0.0.1:2000", "server address host:port")
rpc_encoding = flag.String("rpc_encoding", "gob", "RPC encoding used <gob|json>")
)
@@ -62,8 +61,7 @@ func main() {
}
res := cmd.RpcResult()
if rpcErr := client.Call(cmd.RpcMethod(), cmd.RpcParams(), res); rpcErr != nil {
log.Fatal(rpcErr)
}
fmt.Println(reflect.ValueOf(res).Elem().Interface())
fmt.Println("Result:", res)
}

View File

@@ -106,7 +106,6 @@ func main() {
log.Fatal(err, "\n\t", v.message)
}
}
//sep = []rune(*separator)[0]
sep = ','
csvr := timespans.NewFileCSVReader()
@@ -169,6 +168,8 @@ func main() {
log.Fatalf("Could not open database connection: %v", err)
}
// writing to database
csvr.WriteToDatabase(getter, *flush, true)
// write maps to database
if err := csvr.WriteToDatabase(getter, *flush, true); err != nil {
log.Fatal("Could not write to database: ", err)
}
}