func main() { flag.Usage = Usage var host string var port int var protocol string var urlString string var framed bool var useHttp bool var parsedUrl url.URL var trans thrift.TTransport _ = math.MinInt32 // will become unneeded eventually _ = strconv.Atoi flag.Usage = Usage flag.StringVar(&host, "h", "localhost", "Specify host and port") flag.IntVar(&port, "p", 9090, "Specify port") flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") flag.StringVar(&urlString, "u", "", "Specify the url") flag.BoolVar(&framed, "framed", false, "Use framed transport") flag.BoolVar(&useHttp, "http", false, "Use http") flag.Parse() if len(urlString) > 0 { parsedUrl, err := url.Parse(urlString) if err != nil { fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) flag.Usage() } host = parsedUrl.Host useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" } else if useHttp { _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) if err != nil { fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) flag.Usage() } } cmd := flag.Arg(0) var err error if useHttp { trans, err = thrift.NewTHttpClient(parsedUrl.String()) } else { portStr := fmt.Sprint(port) if strings.Contains(host, ":") { host, portStr, err = net.SplitHostPort(host) if err != nil { fmt.Fprintln(os.Stderr, "error with host:", err) os.Exit(1) } } trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) if err != nil { fmt.Fprintln(os.Stderr, "error resolving address:", err) os.Exit(1) } if framed { trans = thrift.NewTFramedTransport(trans) } } if err != nil { fmt.Fprintln(os.Stderr, "Error creating transport", err) os.Exit(1) } defer trans.Close() var protocolFactory thrift.TProtocolFactory switch protocol { case "compact": protocolFactory = thrift.NewTCompactProtocolFactory() break case "simplejson": protocolFactory = thrift.NewTSimpleJSONProtocolFactory() break case "json": protocolFactory = thrift.NewTJSONProtocolFactory() break case "binary", "": protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() break default: fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) Usage() os.Exit(1) } client := Hbase.NewHbaseClientFactory(trans, protocolFactory) if err := trans.Open(); err != nil { fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) os.Exit(1) } switch cmd { case "enableTable": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "EnableTable requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Bytes(argvalue0) fmt.Print(client.EnableTable(value0)) fmt.Print("\n") break case "disableTable": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "DisableTable requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Bytes(argvalue0) fmt.Print(client.DisableTable(value0)) fmt.Print("\n") break case "isTableEnabled": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "IsTableEnabled requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Bytes(argvalue0) fmt.Print(client.IsTableEnabled(value0)) fmt.Print("\n") break case "compact": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "Compact requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Bytes(argvalue0) fmt.Print(client.Compact(value0)) fmt.Print("\n") break case "majorCompact": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "MajorCompact requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Bytes(argvalue0) fmt.Print(client.MajorCompact(value0)) fmt.Print("\n") break case "getTableNames": if flag.NArg()-1 != 0 { fmt.Fprintln(os.Stderr, "GetTableNames requires 0 args") flag.Usage() } fmt.Print(client.GetTableNames()) fmt.Print("\n") break case "getColumnDescriptors": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "GetColumnDescriptors requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) fmt.Print(client.GetColumnDescriptors(value0)) fmt.Print("\n") break case "getTableRegions": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "GetTableRegions requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) fmt.Print(client.GetTableRegions(value0)) fmt.Print("\n") break case "createTable": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "CreateTable requires 2 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg274 := flag.Arg(2) mbTrans275 := thrift.NewTMemoryBufferLen(len(arg274)) defer mbTrans275.Close() _, err276 := mbTrans275.WriteString(arg274) if err276 != nil { Usage() return } factory277 := thrift.NewTSimpleJSONProtocolFactory() jsProt278 := factory277.GetProtocol(mbTrans275) containerStruct1 := Hbase.NewCreateTableArgs() err279 := containerStruct1.ReadField2(jsProt278) if err279 != nil { Usage() return } argvalue1 := containerStruct1.ColumnFamilies value1 := argvalue1 fmt.Print(client.CreateTable(value0, value1)) fmt.Print("\n") break case "deleteTable": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "DeleteTable requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) fmt.Print(client.DeleteTable(value0)) fmt.Print("\n") break case "get": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "Get requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) arg284 := flag.Arg(4) mbTrans285 := thrift.NewTMemoryBufferLen(len(arg284)) defer mbTrans285.Close() _, err286 := mbTrans285.WriteString(arg284) if err286 != nil { Usage() return } factory287 := thrift.NewTSimpleJSONProtocolFactory() jsProt288 := factory287.GetProtocol(mbTrans285) containerStruct3 := Hbase.NewGetArgs() err289 := containerStruct3.ReadField4(jsProt288) if err289 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.Get(value0, value1, value2, value3)) fmt.Print("\n") break case "getVer": if flag.NArg()-1 != 5 { fmt.Fprintln(os.Stderr, "GetVer requires 5 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) tmp3, err293 := (strconv.Atoi(flag.Arg(4))) if err293 != nil { Usage() return } argvalue3 := int32(tmp3) value3 := argvalue3 arg294 := flag.Arg(5) mbTrans295 := thrift.NewTMemoryBufferLen(len(arg294)) defer mbTrans295.Close() _, err296 := mbTrans295.WriteString(arg294) if err296 != nil { Usage() return } factory297 := thrift.NewTSimpleJSONProtocolFactory() jsProt298 := factory297.GetProtocol(mbTrans295) containerStruct4 := Hbase.NewGetVerArgs() err299 := containerStruct4.ReadField5(jsProt298) if err299 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.GetVer(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "getVerTs": if flag.NArg()-1 != 6 { fmt.Fprintln(os.Stderr, "GetVerTs requires 6 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) argvalue3, err303 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err303 != nil { Usage() return } value3 := argvalue3 tmp4, err304 := (strconv.Atoi(flag.Arg(5))) if err304 != nil { Usage() return } argvalue4 := int32(tmp4) value4 := argvalue4 arg305 := flag.Arg(6) mbTrans306 := thrift.NewTMemoryBufferLen(len(arg305)) defer mbTrans306.Close() _, err307 := mbTrans306.WriteString(arg305) if err307 != nil { Usage() return } factory308 := thrift.NewTSimpleJSONProtocolFactory() jsProt309 := factory308.GetProtocol(mbTrans306) containerStruct5 := Hbase.NewGetVerTsArgs() err310 := containerStruct5.ReadField6(jsProt309) if err310 != nil { Usage() return } argvalue5 := containerStruct5.Attributes value5 := argvalue5 fmt.Print(client.GetVerTs(value0, value1, value2, value3, value4, value5)) fmt.Print("\n") break case "getRow": if flag.NArg()-1 != 3 { fmt.Fprintln(os.Stderr, "GetRow requires 3 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg313 := flag.Arg(3) mbTrans314 := thrift.NewTMemoryBufferLen(len(arg313)) defer mbTrans314.Close() _, err315 := mbTrans314.WriteString(arg313) if err315 != nil { Usage() return } factory316 := thrift.NewTSimpleJSONProtocolFactory() jsProt317 := factory316.GetProtocol(mbTrans314) containerStruct2 := Hbase.NewGetRowArgs() err318 := containerStruct2.ReadField3(jsProt317) if err318 != nil { Usage() return } argvalue2 := containerStruct2.Attributes value2 := argvalue2 fmt.Print(client.GetRow(value0, value1, value2)) fmt.Print("\n") break case "getRowWithColumns": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "GetRowWithColumns requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg321 := flag.Arg(3) mbTrans322 := thrift.NewTMemoryBufferLen(len(arg321)) defer mbTrans322.Close() _, err323 := mbTrans322.WriteString(arg321) if err323 != nil { Usage() return } factory324 := thrift.NewTSimpleJSONProtocolFactory() jsProt325 := factory324.GetProtocol(mbTrans322) containerStruct2 := Hbase.NewGetRowWithColumnsArgs() err326 := containerStruct2.ReadField3(jsProt325) if err326 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 arg327 := flag.Arg(4) mbTrans328 := thrift.NewTMemoryBufferLen(len(arg327)) defer mbTrans328.Close() _, err329 := mbTrans328.WriteString(arg327) if err329 != nil { Usage() return } factory330 := thrift.NewTSimpleJSONProtocolFactory() jsProt331 := factory330.GetProtocol(mbTrans328) containerStruct3 := Hbase.NewGetRowWithColumnsArgs() err332 := containerStruct3.ReadField4(jsProt331) if err332 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.GetRowWithColumns(value0, value1, value2, value3)) fmt.Print("\n") break case "getRowTs": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "GetRowTs requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2, err335 := (strconv.ParseInt(flag.Arg(3), 10, 64)) if err335 != nil { Usage() return } value2 := argvalue2 arg336 := flag.Arg(4) mbTrans337 := thrift.NewTMemoryBufferLen(len(arg336)) defer mbTrans337.Close() _, err338 := mbTrans337.WriteString(arg336) if err338 != nil { Usage() return } factory339 := thrift.NewTSimpleJSONProtocolFactory() jsProt340 := factory339.GetProtocol(mbTrans337) containerStruct3 := Hbase.NewGetRowTsArgs() err341 := containerStruct3.ReadField4(jsProt340) if err341 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.GetRowTs(value0, value1, value2, value3)) fmt.Print("\n") break case "getRowWithColumnsTs": if flag.NArg()-1 != 5 { fmt.Fprintln(os.Stderr, "GetRowWithColumnsTs requires 5 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg344 := flag.Arg(3) mbTrans345 := thrift.NewTMemoryBufferLen(len(arg344)) defer mbTrans345.Close() _, err346 := mbTrans345.WriteString(arg344) if err346 != nil { Usage() return } factory347 := thrift.NewTSimpleJSONProtocolFactory() jsProt348 := factory347.GetProtocol(mbTrans345) containerStruct2 := Hbase.NewGetRowWithColumnsTsArgs() err349 := containerStruct2.ReadField3(jsProt348) if err349 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 argvalue3, err350 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err350 != nil { Usage() return } value3 := argvalue3 arg351 := flag.Arg(5) mbTrans352 := thrift.NewTMemoryBufferLen(len(arg351)) defer mbTrans352.Close() _, err353 := mbTrans352.WriteString(arg351) if err353 != nil { Usage() return } factory354 := thrift.NewTSimpleJSONProtocolFactory() jsProt355 := factory354.GetProtocol(mbTrans352) containerStruct4 := Hbase.NewGetRowWithColumnsTsArgs() err356 := containerStruct4.ReadField5(jsProt355) if err356 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.GetRowWithColumnsTs(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "getRows": if flag.NArg()-1 != 3 { fmt.Fprintln(os.Stderr, "GetRows requires 3 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg358 := flag.Arg(2) mbTrans359 := thrift.NewTMemoryBufferLen(len(arg358)) defer mbTrans359.Close() _, err360 := mbTrans359.WriteString(arg358) if err360 != nil { Usage() return } factory361 := thrift.NewTSimpleJSONProtocolFactory() jsProt362 := factory361.GetProtocol(mbTrans359) containerStruct1 := Hbase.NewGetRowsArgs() err363 := containerStruct1.ReadField2(jsProt362) if err363 != nil { Usage() return } argvalue1 := containerStruct1.Rows value1 := argvalue1 arg364 := flag.Arg(3) mbTrans365 := thrift.NewTMemoryBufferLen(len(arg364)) defer mbTrans365.Close() _, err366 := mbTrans365.WriteString(arg364) if err366 != nil { Usage() return } factory367 := thrift.NewTSimpleJSONProtocolFactory() jsProt368 := factory367.GetProtocol(mbTrans365) containerStruct2 := Hbase.NewGetRowsArgs() err369 := containerStruct2.ReadField3(jsProt368) if err369 != nil { Usage() return } argvalue2 := containerStruct2.Attributes value2 := argvalue2 fmt.Print(client.GetRows(value0, value1, value2)) fmt.Print("\n") break case "getRowsWithColumns": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "GetRowsWithColumns requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg371 := flag.Arg(2) mbTrans372 := thrift.NewTMemoryBufferLen(len(arg371)) defer mbTrans372.Close() _, err373 := mbTrans372.WriteString(arg371) if err373 != nil { Usage() return } factory374 := thrift.NewTSimpleJSONProtocolFactory() jsProt375 := factory374.GetProtocol(mbTrans372) containerStruct1 := Hbase.NewGetRowsWithColumnsArgs() err376 := containerStruct1.ReadField2(jsProt375) if err376 != nil { Usage() return } argvalue1 := containerStruct1.Rows value1 := argvalue1 arg377 := flag.Arg(3) mbTrans378 := thrift.NewTMemoryBufferLen(len(arg377)) defer mbTrans378.Close() _, err379 := mbTrans378.WriteString(arg377) if err379 != nil { Usage() return } factory380 := thrift.NewTSimpleJSONProtocolFactory() jsProt381 := factory380.GetProtocol(mbTrans378) containerStruct2 := Hbase.NewGetRowsWithColumnsArgs() err382 := containerStruct2.ReadField3(jsProt381) if err382 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 arg383 := flag.Arg(4) mbTrans384 := thrift.NewTMemoryBufferLen(len(arg383)) defer mbTrans384.Close() _, err385 := mbTrans384.WriteString(arg383) if err385 != nil { Usage() return } factory386 := thrift.NewTSimpleJSONProtocolFactory() jsProt387 := factory386.GetProtocol(mbTrans384) containerStruct3 := Hbase.NewGetRowsWithColumnsArgs() err388 := containerStruct3.ReadField4(jsProt387) if err388 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.GetRowsWithColumns(value0, value1, value2, value3)) fmt.Print("\n") break case "getRowsTs": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "GetRowsTs requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg390 := flag.Arg(2) mbTrans391 := thrift.NewTMemoryBufferLen(len(arg390)) defer mbTrans391.Close() _, err392 := mbTrans391.WriteString(arg390) if err392 != nil { Usage() return } factory393 := thrift.NewTSimpleJSONProtocolFactory() jsProt394 := factory393.GetProtocol(mbTrans391) containerStruct1 := Hbase.NewGetRowsTsArgs() err395 := containerStruct1.ReadField2(jsProt394) if err395 != nil { Usage() return } argvalue1 := containerStruct1.Rows value1 := argvalue1 argvalue2, err396 := (strconv.ParseInt(flag.Arg(3), 10, 64)) if err396 != nil { Usage() return } value2 := argvalue2 arg397 := flag.Arg(4) mbTrans398 := thrift.NewTMemoryBufferLen(len(arg397)) defer mbTrans398.Close() _, err399 := mbTrans398.WriteString(arg397) if err399 != nil { Usage() return } factory400 := thrift.NewTSimpleJSONProtocolFactory() jsProt401 := factory400.GetProtocol(mbTrans398) containerStruct3 := Hbase.NewGetRowsTsArgs() err402 := containerStruct3.ReadField4(jsProt401) if err402 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.GetRowsTs(value0, value1, value2, value3)) fmt.Print("\n") break case "getRowsWithColumnsTs": if flag.NArg()-1 != 5 { fmt.Fprintln(os.Stderr, "GetRowsWithColumnsTs requires 5 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg404 := flag.Arg(2) mbTrans405 := thrift.NewTMemoryBufferLen(len(arg404)) defer mbTrans405.Close() _, err406 := mbTrans405.WriteString(arg404) if err406 != nil { Usage() return } factory407 := thrift.NewTSimpleJSONProtocolFactory() jsProt408 := factory407.GetProtocol(mbTrans405) containerStruct1 := Hbase.NewGetRowsWithColumnsTsArgs() err409 := containerStruct1.ReadField2(jsProt408) if err409 != nil { Usage() return } argvalue1 := containerStruct1.Rows value1 := argvalue1 arg410 := flag.Arg(3) mbTrans411 := thrift.NewTMemoryBufferLen(len(arg410)) defer mbTrans411.Close() _, err412 := mbTrans411.WriteString(arg410) if err412 != nil { Usage() return } factory413 := thrift.NewTSimpleJSONProtocolFactory() jsProt414 := factory413.GetProtocol(mbTrans411) containerStruct2 := Hbase.NewGetRowsWithColumnsTsArgs() err415 := containerStruct2.ReadField3(jsProt414) if err415 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 argvalue3, err416 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err416 != nil { Usage() return } value3 := argvalue3 arg417 := flag.Arg(5) mbTrans418 := thrift.NewTMemoryBufferLen(len(arg417)) defer mbTrans418.Close() _, err419 := mbTrans418.WriteString(arg417) if err419 != nil { Usage() return } factory420 := thrift.NewTSimpleJSONProtocolFactory() jsProt421 := factory420.GetProtocol(mbTrans418) containerStruct4 := Hbase.NewGetRowsWithColumnsTsArgs() err422 := containerStruct4.ReadField5(jsProt421) if err422 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.GetRowsWithColumnsTs(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "mutateRow": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "MutateRow requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg425 := flag.Arg(3) mbTrans426 := thrift.NewTMemoryBufferLen(len(arg425)) defer mbTrans426.Close() _, err427 := mbTrans426.WriteString(arg425) if err427 != nil { Usage() return } factory428 := thrift.NewTSimpleJSONProtocolFactory() jsProt429 := factory428.GetProtocol(mbTrans426) containerStruct2 := Hbase.NewMutateRowArgs() err430 := containerStruct2.ReadField3(jsProt429) if err430 != nil { Usage() return } argvalue2 := containerStruct2.Mutations value2 := argvalue2 arg431 := flag.Arg(4) mbTrans432 := thrift.NewTMemoryBufferLen(len(arg431)) defer mbTrans432.Close() _, err433 := mbTrans432.WriteString(arg431) if err433 != nil { Usage() return } factory434 := thrift.NewTSimpleJSONProtocolFactory() jsProt435 := factory434.GetProtocol(mbTrans432) containerStruct3 := Hbase.NewMutateRowArgs() err436 := containerStruct3.ReadField4(jsProt435) if err436 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.MutateRow(value0, value1, value2, value3)) fmt.Print("\n") break case "mutateRowTs": if flag.NArg()-1 != 5 { fmt.Fprintln(os.Stderr, "MutateRowTs requires 5 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg439 := flag.Arg(3) mbTrans440 := thrift.NewTMemoryBufferLen(len(arg439)) defer mbTrans440.Close() _, err441 := mbTrans440.WriteString(arg439) if err441 != nil { Usage() return } factory442 := thrift.NewTSimpleJSONProtocolFactory() jsProt443 := factory442.GetProtocol(mbTrans440) containerStruct2 := Hbase.NewMutateRowTsArgs() err444 := containerStruct2.ReadField3(jsProt443) if err444 != nil { Usage() return } argvalue2 := containerStruct2.Mutations value2 := argvalue2 argvalue3, err445 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err445 != nil { Usage() return } value3 := argvalue3 arg446 := flag.Arg(5) mbTrans447 := thrift.NewTMemoryBufferLen(len(arg446)) defer mbTrans447.Close() _, err448 := mbTrans447.WriteString(arg446) if err448 != nil { Usage() return } factory449 := thrift.NewTSimpleJSONProtocolFactory() jsProt450 := factory449.GetProtocol(mbTrans447) containerStruct4 := Hbase.NewMutateRowTsArgs() err451 := containerStruct4.ReadField5(jsProt450) if err451 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.MutateRowTs(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "mutateRows": if flag.NArg()-1 != 3 { fmt.Fprintln(os.Stderr, "MutateRows requires 3 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg453 := flag.Arg(2) mbTrans454 := thrift.NewTMemoryBufferLen(len(arg453)) defer mbTrans454.Close() _, err455 := mbTrans454.WriteString(arg453) if err455 != nil { Usage() return } factory456 := thrift.NewTSimpleJSONProtocolFactory() jsProt457 := factory456.GetProtocol(mbTrans454) containerStruct1 := Hbase.NewMutateRowsArgs() err458 := containerStruct1.ReadField2(jsProt457) if err458 != nil { Usage() return } argvalue1 := containerStruct1.RowBatches value1 := argvalue1 arg459 := flag.Arg(3) mbTrans460 := thrift.NewTMemoryBufferLen(len(arg459)) defer mbTrans460.Close() _, err461 := mbTrans460.WriteString(arg459) if err461 != nil { Usage() return } factory462 := thrift.NewTSimpleJSONProtocolFactory() jsProt463 := factory462.GetProtocol(mbTrans460) containerStruct2 := Hbase.NewMutateRowsArgs() err464 := containerStruct2.ReadField3(jsProt463) if err464 != nil { Usage() return } argvalue2 := containerStruct2.Attributes value2 := argvalue2 fmt.Print(client.MutateRows(value0, value1, value2)) fmt.Print("\n") break case "mutateRowsTs": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "MutateRowsTs requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg466 := flag.Arg(2) mbTrans467 := thrift.NewTMemoryBufferLen(len(arg466)) defer mbTrans467.Close() _, err468 := mbTrans467.WriteString(arg466) if err468 != nil { Usage() return } factory469 := thrift.NewTSimpleJSONProtocolFactory() jsProt470 := factory469.GetProtocol(mbTrans467) containerStruct1 := Hbase.NewMutateRowsTsArgs() err471 := containerStruct1.ReadField2(jsProt470) if err471 != nil { Usage() return } argvalue1 := containerStruct1.RowBatches value1 := argvalue1 argvalue2, err472 := (strconv.ParseInt(flag.Arg(3), 10, 64)) if err472 != nil { Usage() return } value2 := argvalue2 arg473 := flag.Arg(4) mbTrans474 := thrift.NewTMemoryBufferLen(len(arg473)) defer mbTrans474.Close() _, err475 := mbTrans474.WriteString(arg473) if err475 != nil { Usage() return } factory476 := thrift.NewTSimpleJSONProtocolFactory() jsProt477 := factory476.GetProtocol(mbTrans474) containerStruct3 := Hbase.NewMutateRowsTsArgs() err478 := containerStruct3.ReadField4(jsProt477) if err478 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.MutateRowsTs(value0, value1, value2, value3)) fmt.Print("\n") break case "atomicIncrement": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "AtomicIncrement requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) argvalue3, err482 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err482 != nil { Usage() return } value3 := argvalue3 fmt.Print(client.AtomicIncrement(value0, value1, value2, value3)) fmt.Print("\n") break case "deleteAll": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "DeleteAll requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) arg486 := flag.Arg(4) mbTrans487 := thrift.NewTMemoryBufferLen(len(arg486)) defer mbTrans487.Close() _, err488 := mbTrans487.WriteString(arg486) if err488 != nil { Usage() return } factory489 := thrift.NewTSimpleJSONProtocolFactory() jsProt490 := factory489.GetProtocol(mbTrans487) containerStruct3 := Hbase.NewDeleteAllArgs() err491 := containerStruct3.ReadField4(jsProt490) if err491 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.DeleteAll(value0, value1, value2, value3)) fmt.Print("\n") break case "deleteAllTs": if flag.NArg()-1 != 5 { fmt.Fprintln(os.Stderr, "DeleteAllTs requires 5 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) argvalue3, err495 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err495 != nil { Usage() return } value3 := argvalue3 arg496 := flag.Arg(5) mbTrans497 := thrift.NewTMemoryBufferLen(len(arg496)) defer mbTrans497.Close() _, err498 := mbTrans497.WriteString(arg496) if err498 != nil { Usage() return } factory499 := thrift.NewTSimpleJSONProtocolFactory() jsProt500 := factory499.GetProtocol(mbTrans497) containerStruct4 := Hbase.NewDeleteAllTsArgs() err501 := containerStruct4.ReadField5(jsProt500) if err501 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.DeleteAllTs(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "deleteAllRow": if flag.NArg()-1 != 3 { fmt.Fprintln(os.Stderr, "DeleteAllRow requires 3 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg504 := flag.Arg(3) mbTrans505 := thrift.NewTMemoryBufferLen(len(arg504)) defer mbTrans505.Close() _, err506 := mbTrans505.WriteString(arg504) if err506 != nil { Usage() return } factory507 := thrift.NewTSimpleJSONProtocolFactory() jsProt508 := factory507.GetProtocol(mbTrans505) containerStruct2 := Hbase.NewDeleteAllRowArgs() err509 := containerStruct2.ReadField3(jsProt508) if err509 != nil { Usage() return } argvalue2 := containerStruct2.Attributes value2 := argvalue2 fmt.Print(client.DeleteAllRow(value0, value1, value2)) fmt.Print("\n") break case "increment": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "Increment requires 1 args") flag.Usage() } arg510 := flag.Arg(1) mbTrans511 := thrift.NewTMemoryBufferLen(len(arg510)) defer mbTrans511.Close() _, err512 := mbTrans511.WriteString(arg510) if err512 != nil { Usage() return } factory513 := thrift.NewTSimpleJSONProtocolFactory() jsProt514 := factory513.GetProtocol(mbTrans511) argvalue0 := Hbase.NewTIncrement() err515 := argvalue0.Read(jsProt514) if err515 != nil { Usage() return } value0 := argvalue0 fmt.Print(client.Increment(value0)) fmt.Print("\n") break case "incrementRows": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "IncrementRows requires 1 args") flag.Usage() } arg516 := flag.Arg(1) mbTrans517 := thrift.NewTMemoryBufferLen(len(arg516)) defer mbTrans517.Close() _, err518 := mbTrans517.WriteString(arg516) if err518 != nil { Usage() return } factory519 := thrift.NewTSimpleJSONProtocolFactory() jsProt520 := factory519.GetProtocol(mbTrans517) containerStruct0 := Hbase.NewIncrementRowsArgs() err521 := containerStruct0.ReadField1(jsProt520) if err521 != nil { Usage() return } argvalue0 := containerStruct0.Increments value0 := argvalue0 fmt.Print(client.IncrementRows(value0)) fmt.Print("\n") break case "deleteAllRowTs": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "DeleteAllRowTs requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2, err524 := (strconv.ParseInt(flag.Arg(3), 10, 64)) if err524 != nil { Usage() return } value2 := argvalue2 arg525 := flag.Arg(4) mbTrans526 := thrift.NewTMemoryBufferLen(len(arg525)) defer mbTrans526.Close() _, err527 := mbTrans526.WriteString(arg525) if err527 != nil { Usage() return } factory528 := thrift.NewTSimpleJSONProtocolFactory() jsProt529 := factory528.GetProtocol(mbTrans526) containerStruct3 := Hbase.NewDeleteAllRowTsArgs() err530 := containerStruct3.ReadField4(jsProt529) if err530 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.DeleteAllRowTs(value0, value1, value2, value3)) fmt.Print("\n") break case "scannerOpenWithScan": if flag.NArg()-1 != 3 { fmt.Fprintln(os.Stderr, "ScannerOpenWithScan requires 3 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg532 := flag.Arg(2) mbTrans533 := thrift.NewTMemoryBufferLen(len(arg532)) defer mbTrans533.Close() _, err534 := mbTrans533.WriteString(arg532) if err534 != nil { Usage() return } factory535 := thrift.NewTSimpleJSONProtocolFactory() jsProt536 := factory535.GetProtocol(mbTrans533) argvalue1 := Hbase.NewTScan() err537 := argvalue1.Read(jsProt536) if err537 != nil { Usage() return } value1 := argvalue1 arg538 := flag.Arg(3) mbTrans539 := thrift.NewTMemoryBufferLen(len(arg538)) defer mbTrans539.Close() _, err540 := mbTrans539.WriteString(arg538) if err540 != nil { Usage() return } factory541 := thrift.NewTSimpleJSONProtocolFactory() jsProt542 := factory541.GetProtocol(mbTrans539) containerStruct2 := Hbase.NewScannerOpenWithScanArgs() err543 := containerStruct2.ReadField3(jsProt542) if err543 != nil { Usage() return } argvalue2 := containerStruct2.Attributes value2 := argvalue2 fmt.Print(client.ScannerOpenWithScan(value0, value1, value2)) fmt.Print("\n") break case "scannerOpen": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "ScannerOpen requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg546 := flag.Arg(3) mbTrans547 := thrift.NewTMemoryBufferLen(len(arg546)) defer mbTrans547.Close() _, err548 := mbTrans547.WriteString(arg546) if err548 != nil { Usage() return } factory549 := thrift.NewTSimpleJSONProtocolFactory() jsProt550 := factory549.GetProtocol(mbTrans547) containerStruct2 := Hbase.NewScannerOpenArgs() err551 := containerStruct2.ReadField3(jsProt550) if err551 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 arg552 := flag.Arg(4) mbTrans553 := thrift.NewTMemoryBufferLen(len(arg552)) defer mbTrans553.Close() _, err554 := mbTrans553.WriteString(arg552) if err554 != nil { Usage() return } factory555 := thrift.NewTSimpleJSONProtocolFactory() jsProt556 := factory555.GetProtocol(mbTrans553) containerStruct3 := Hbase.NewScannerOpenArgs() err557 := containerStruct3.ReadField4(jsProt556) if err557 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.ScannerOpen(value0, value1, value2, value3)) fmt.Print("\n") break case "scannerOpenWithStop": if flag.NArg()-1 != 5 { fmt.Fprintln(os.Stderr, "ScannerOpenWithStop requires 5 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) arg561 := flag.Arg(4) mbTrans562 := thrift.NewTMemoryBufferLen(len(arg561)) defer mbTrans562.Close() _, err563 := mbTrans562.WriteString(arg561) if err563 != nil { Usage() return } factory564 := thrift.NewTSimpleJSONProtocolFactory() jsProt565 := factory564.GetProtocol(mbTrans562) containerStruct3 := Hbase.NewScannerOpenWithStopArgs() err566 := containerStruct3.ReadField4(jsProt565) if err566 != nil { Usage() return } argvalue3 := containerStruct3.Columns value3 := argvalue3 arg567 := flag.Arg(5) mbTrans568 := thrift.NewTMemoryBufferLen(len(arg567)) defer mbTrans568.Close() _, err569 := mbTrans568.WriteString(arg567) if err569 != nil { Usage() return } factory570 := thrift.NewTSimpleJSONProtocolFactory() jsProt571 := factory570.GetProtocol(mbTrans568) containerStruct4 := Hbase.NewScannerOpenWithStopArgs() err572 := containerStruct4.ReadField5(jsProt571) if err572 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.ScannerOpenWithStop(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "scannerOpenWithPrefix": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "ScannerOpenWithPrefix requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg575 := flag.Arg(3) mbTrans576 := thrift.NewTMemoryBufferLen(len(arg575)) defer mbTrans576.Close() _, err577 := mbTrans576.WriteString(arg575) if err577 != nil { Usage() return } factory578 := thrift.NewTSimpleJSONProtocolFactory() jsProt579 := factory578.GetProtocol(mbTrans576) containerStruct2 := Hbase.NewScannerOpenWithPrefixArgs() err580 := containerStruct2.ReadField3(jsProt579) if err580 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 arg581 := flag.Arg(4) mbTrans582 := thrift.NewTMemoryBufferLen(len(arg581)) defer mbTrans582.Close() _, err583 := mbTrans582.WriteString(arg581) if err583 != nil { Usage() return } factory584 := thrift.NewTSimpleJSONProtocolFactory() jsProt585 := factory584.GetProtocol(mbTrans582) containerStruct3 := Hbase.NewScannerOpenWithPrefixArgs() err586 := containerStruct3.ReadField4(jsProt585) if err586 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.ScannerOpenWithPrefix(value0, value1, value2, value3)) fmt.Print("\n") break case "scannerOpenTs": if flag.NArg()-1 != 5 { fmt.Fprintln(os.Stderr, "ScannerOpenTs requires 5 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg589 := flag.Arg(3) mbTrans590 := thrift.NewTMemoryBufferLen(len(arg589)) defer mbTrans590.Close() _, err591 := mbTrans590.WriteString(arg589) if err591 != nil { Usage() return } factory592 := thrift.NewTSimpleJSONProtocolFactory() jsProt593 := factory592.GetProtocol(mbTrans590) containerStruct2 := Hbase.NewScannerOpenTsArgs() err594 := containerStruct2.ReadField3(jsProt593) if err594 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 argvalue3, err595 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err595 != nil { Usage() return } value3 := argvalue3 arg596 := flag.Arg(5) mbTrans597 := thrift.NewTMemoryBufferLen(len(arg596)) defer mbTrans597.Close() _, err598 := mbTrans597.WriteString(arg596) if err598 != nil { Usage() return } factory599 := thrift.NewTSimpleJSONProtocolFactory() jsProt600 := factory599.GetProtocol(mbTrans597) containerStruct4 := Hbase.NewScannerOpenTsArgs() err601 := containerStruct4.ReadField5(jsProt600) if err601 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.ScannerOpenTs(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "scannerOpenWithStopTs": if flag.NArg()-1 != 6 { fmt.Fprintln(os.Stderr, "ScannerOpenWithStopTs requires 6 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) arg605 := flag.Arg(4) mbTrans606 := thrift.NewTMemoryBufferLen(len(arg605)) defer mbTrans606.Close() _, err607 := mbTrans606.WriteString(arg605) if err607 != nil { Usage() return } factory608 := thrift.NewTSimpleJSONProtocolFactory() jsProt609 := factory608.GetProtocol(mbTrans606) containerStruct3 := Hbase.NewScannerOpenWithStopTsArgs() err610 := containerStruct3.ReadField4(jsProt609) if err610 != nil { Usage() return } argvalue3 := containerStruct3.Columns value3 := argvalue3 argvalue4, err611 := (strconv.ParseInt(flag.Arg(5), 10, 64)) if err611 != nil { Usage() return } value4 := argvalue4 arg612 := flag.Arg(6) mbTrans613 := thrift.NewTMemoryBufferLen(len(arg612)) defer mbTrans613.Close() _, err614 := mbTrans613.WriteString(arg612) if err614 != nil { Usage() return } factory615 := thrift.NewTSimpleJSONProtocolFactory() jsProt616 := factory615.GetProtocol(mbTrans613) containerStruct5 := Hbase.NewScannerOpenWithStopTsArgs() err617 := containerStruct5.ReadField6(jsProt616) if err617 != nil { Usage() return } argvalue5 := containerStruct5.Attributes value5 := argvalue5 fmt.Print(client.ScannerOpenWithStopTs(value0, value1, value2, value3, value4, value5)) fmt.Print("\n") break case "scannerGet": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "ScannerGet requires 1 args") flag.Usage() } tmp0, err618 := (strconv.Atoi(flag.Arg(1))) if err618 != nil { Usage() return } argvalue0 := int32(tmp0) value0 := Hbase.ScannerID(argvalue0) fmt.Print(client.ScannerGet(value0)) fmt.Print("\n") break case "scannerGetList": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "ScannerGetList requires 2 args") flag.Usage() } tmp0, err619 := (strconv.Atoi(flag.Arg(1))) if err619 != nil { Usage() return } argvalue0 := int32(tmp0) value0 := Hbase.ScannerID(argvalue0) tmp1, err620 := (strconv.Atoi(flag.Arg(2))) if err620 != nil { Usage() return } argvalue1 := int32(tmp1) value1 := argvalue1 fmt.Print(client.ScannerGetList(value0, value1)) fmt.Print("\n") break case "scannerClose": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "ScannerClose requires 1 args") flag.Usage() } tmp0, err621 := (strconv.Atoi(flag.Arg(1))) if err621 != nil { Usage() return } argvalue0 := int32(tmp0) value0 := Hbase.ScannerID(argvalue0) fmt.Print(client.ScannerClose(value0)) fmt.Print("\n") break case "getRowOrBefore": if flag.NArg()-1 != 3 { fmt.Fprintln(os.Stderr, "GetRowOrBefore requires 3 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) fmt.Print(client.GetRowOrBefore(value0, value1, value2)) fmt.Print("\n") break case "getRegionInfo": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "GetRegionInfo requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) fmt.Print(client.GetRegionInfo(value0)) fmt.Print("\n") break case "": Usage() break default: fmt.Fprintln(os.Stderr, "Invalid function ", cmd) } }
func main() { flag.Usage = Usage var host string var port int var protocol string var urlString string var framed bool var useHttp bool var help bool var parsedUrl url.URL var trans thrift.TTransport flag.Usage = Usage flag.StringVar(&host, "h", "localhost", "Specify host and port") flag.IntVar(&port, "p", 9090, "Specify port") flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") flag.StringVar(&urlString, "u", "", "Specify the url") flag.BoolVar(&framed, "framed", false, "Use framed transport") flag.BoolVar(&useHttp, "http", false, "Use http") flag.BoolVar(&help, "help", false, "See usage string") flag.Parse() if help || flag.NArg() == 0 { flag.Usage() } if len(urlString) > 0 { parsedUrl, err := url.Parse(urlString) if err != nil { fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n") flag.Usage() } host = parsedUrl.Host useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" } else if useHttp { _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) if err != nil { fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n") flag.Usage() } } cmd := flag.Arg(0) var err error if useHttp { trans, err = thrift.NewTHttpClient(parsedUrl.String()) } else { addr, err := net.ResolveTCPAddr("tcp", fmt.Sprint(host, ":", port)) if err != nil { fmt.Fprint(os.Stderr, "Error resolving address", err.Error()) os.Exit(1) } trans, err = thrift.NewTNonblockingSocketAddr(addr) if framed { trans = thrift.NewTFramedTransport(trans) } } if err != nil { fmt.Fprint(os.Stderr, "Error creating transport", err.Error()) os.Exit(1) } defer trans.Close() var protocolFactory thrift.TProtocolFactory switch protocol { case "compact": protocolFactory = thrift.NewTCompactProtocolFactory() break case "simplejson": protocolFactory = thrift.NewTSimpleJSONProtocolFactory() break case "json": protocolFactory = thrift.NewTJSONProtocolFactory() break case "binary", "": protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() break default: fmt.Fprint(os.Stderr, "Invalid protocol specified: ", protocol, "\n") Usage() os.Exit(1) } client := Hbase.NewHbaseClientFactory(trans, protocolFactory) if err = trans.Open(); err != nil { fmt.Fprint(os.Stderr, "Error opening socket to ", host, ":", port, " ", err.Error()) os.Exit(1) } switch cmd { case "enableTable": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "EnableTable requires 1 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Bytes(argvalue0) fmt.Print(client.EnableTable(value0)) fmt.Print("\n") break case "disableTable": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "DisableTable requires 1 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Bytes(argvalue0) fmt.Print(client.DisableTable(value0)) fmt.Print("\n") break case "isTableEnabled": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "IsTableEnabled requires 1 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Bytes(argvalue0) fmt.Print(client.IsTableEnabled(value0)) fmt.Print("\n") break case "compact": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "Compact requires 1 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Bytes(argvalue0) fmt.Print(client.Compact(value0)) fmt.Print("\n") break case "majorCompact": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "MajorCompact requires 1 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Bytes(argvalue0) fmt.Print(client.MajorCompact(value0)) fmt.Print("\n") break case "getTableNames": if flag.NArg()-1 != 0 { fmt.Fprint(os.Stderr, "GetTableNames requires 0 args\n") flag.Usage() } fmt.Print(client.GetTableNames()) fmt.Print("\n") break case "getColumnDescriptors": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "GetColumnDescriptors requires 1 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) fmt.Print(client.GetColumnDescriptors(value0)) fmt.Print("\n") break case "getTableRegions": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "GetTableRegions requires 1 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) fmt.Print(client.GetTableRegions(value0)) fmt.Print("\n") break case "createTable": if flag.NArg()-1 != 2 { fmt.Fprint(os.Stderr, "CreateTable requires 2 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg1635 := flag.Arg(2) mbTrans1636 := thrift.NewTMemoryBufferLen(len(arg1635)) defer mbTrans1636.Close() _, err1637 := mbTrans1636.WriteString(arg1635) if err1637 != nil { Usage() return } factory1638 := thrift.NewTSimpleJSONProtocolFactory() jsProt1639 := factory1638.GetProtocol(mbTrans1636) containerStruct1 := Hbase.NewCreateTableArgs() err1640 := containerStruct1.ReadField2(jsProt1639) if err1640 != nil { Usage() return } argvalue1 := containerStruct1.ColumnFamilies value1 := argvalue1 fmt.Print(client.CreateTable(value0, value1)) fmt.Print("\n") break case "deleteTable": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "DeleteTable requires 1 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) fmt.Print(client.DeleteTable(value0)) fmt.Print("\n") break case "get": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "Get requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) arg1645 := flag.Arg(4) mbTrans1646 := thrift.NewTMemoryBufferLen(len(arg1645)) defer mbTrans1646.Close() _, err1647 := mbTrans1646.WriteString(arg1645) if err1647 != nil { Usage() return } factory1648 := thrift.NewTSimpleJSONProtocolFactory() jsProt1649 := factory1648.GetProtocol(mbTrans1646) containerStruct3 := Hbase.NewGetArgs() err1650 := containerStruct3.ReadField4(jsProt1649) if err1650 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.Get(value0, value1, value2, value3)) fmt.Print("\n") break case "getVer": if flag.NArg()-1 != 5 { fmt.Fprint(os.Stderr, "GetVer requires 5 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) tmp3, err1654 := (strconv.Atoi(flag.Arg(4))) if err1654 != nil { Usage() return } argvalue3 := int32(tmp3) value3 := argvalue3 arg1655 := flag.Arg(5) mbTrans1656 := thrift.NewTMemoryBufferLen(len(arg1655)) defer mbTrans1656.Close() _, err1657 := mbTrans1656.WriteString(arg1655) if err1657 != nil { Usage() return } factory1658 := thrift.NewTSimpleJSONProtocolFactory() jsProt1659 := factory1658.GetProtocol(mbTrans1656) containerStruct4 := Hbase.NewGetVerArgs() err1660 := containerStruct4.ReadField5(jsProt1659) if err1660 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.GetVer(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "getVerTs": if flag.NArg()-1 != 6 { fmt.Fprint(os.Stderr, "GetVerTs requires 6 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) argvalue3, err1664 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err1664 != nil { Usage() return } value3 := argvalue3 tmp4, err1665 := (strconv.Atoi(flag.Arg(5))) if err1665 != nil { Usage() return } argvalue4 := int32(tmp4) value4 := argvalue4 arg1666 := flag.Arg(6) mbTrans1667 := thrift.NewTMemoryBufferLen(len(arg1666)) defer mbTrans1667.Close() _, err1668 := mbTrans1667.WriteString(arg1666) if err1668 != nil { Usage() return } factory1669 := thrift.NewTSimpleJSONProtocolFactory() jsProt1670 := factory1669.GetProtocol(mbTrans1667) containerStruct5 := Hbase.NewGetVerTsArgs() err1671 := containerStruct5.ReadField6(jsProt1670) if err1671 != nil { Usage() return } argvalue5 := containerStruct5.Attributes value5 := argvalue5 fmt.Print(client.GetVerTs(value0, value1, value2, value3, value4, value5)) fmt.Print("\n") break case "getRow": if flag.NArg()-1 != 3 { fmt.Fprint(os.Stderr, "GetRow requires 3 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg1674 := flag.Arg(3) mbTrans1675 := thrift.NewTMemoryBufferLen(len(arg1674)) defer mbTrans1675.Close() _, err1676 := mbTrans1675.WriteString(arg1674) if err1676 != nil { Usage() return } factory1677 := thrift.NewTSimpleJSONProtocolFactory() jsProt1678 := factory1677.GetProtocol(mbTrans1675) containerStruct2 := Hbase.NewGetRowArgs() err1679 := containerStruct2.ReadField3(jsProt1678) if err1679 != nil { Usage() return } argvalue2 := containerStruct2.Attributes value2 := argvalue2 fmt.Print(client.GetRow(value0, value1, value2)) fmt.Print("\n") break case "getRowWithColumns": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "GetRowWithColumns requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg1682 := flag.Arg(3) mbTrans1683 := thrift.NewTMemoryBufferLen(len(arg1682)) defer mbTrans1683.Close() _, err1684 := mbTrans1683.WriteString(arg1682) if err1684 != nil { Usage() return } factory1685 := thrift.NewTSimpleJSONProtocolFactory() jsProt1686 := factory1685.GetProtocol(mbTrans1683) containerStruct2 := Hbase.NewGetRowWithColumnsArgs() err1687 := containerStruct2.ReadField3(jsProt1686) if err1687 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 arg1688 := flag.Arg(4) mbTrans1689 := thrift.NewTMemoryBufferLen(len(arg1688)) defer mbTrans1689.Close() _, err1690 := mbTrans1689.WriteString(arg1688) if err1690 != nil { Usage() return } factory1691 := thrift.NewTSimpleJSONProtocolFactory() jsProt1692 := factory1691.GetProtocol(mbTrans1689) containerStruct3 := Hbase.NewGetRowWithColumnsArgs() err1693 := containerStruct3.ReadField4(jsProt1692) if err1693 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.GetRowWithColumns(value0, value1, value2, value3)) fmt.Print("\n") break case "getRowTs": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "GetRowTs requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2, err1696 := (strconv.ParseInt(flag.Arg(3), 10, 64)) if err1696 != nil { Usage() return } value2 := argvalue2 arg1697 := flag.Arg(4) mbTrans1698 := thrift.NewTMemoryBufferLen(len(arg1697)) defer mbTrans1698.Close() _, err1699 := mbTrans1698.WriteString(arg1697) if err1699 != nil { Usage() return } factory1700 := thrift.NewTSimpleJSONProtocolFactory() jsProt1701 := factory1700.GetProtocol(mbTrans1698) containerStruct3 := Hbase.NewGetRowTsArgs() err1702 := containerStruct3.ReadField4(jsProt1701) if err1702 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.GetRowTs(value0, value1, value2, value3)) fmt.Print("\n") break case "getRowWithColumnsTs": if flag.NArg()-1 != 5 { fmt.Fprint(os.Stderr, "GetRowWithColumnsTs requires 5 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg1705 := flag.Arg(3) mbTrans1706 := thrift.NewTMemoryBufferLen(len(arg1705)) defer mbTrans1706.Close() _, err1707 := mbTrans1706.WriteString(arg1705) if err1707 != nil { Usage() return } factory1708 := thrift.NewTSimpleJSONProtocolFactory() jsProt1709 := factory1708.GetProtocol(mbTrans1706) containerStruct2 := Hbase.NewGetRowWithColumnsTsArgs() err1710 := containerStruct2.ReadField3(jsProt1709) if err1710 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 argvalue3, err1711 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err1711 != nil { Usage() return } value3 := argvalue3 arg1712 := flag.Arg(5) mbTrans1713 := thrift.NewTMemoryBufferLen(len(arg1712)) defer mbTrans1713.Close() _, err1714 := mbTrans1713.WriteString(arg1712) if err1714 != nil { Usage() return } factory1715 := thrift.NewTSimpleJSONProtocolFactory() jsProt1716 := factory1715.GetProtocol(mbTrans1713) containerStruct4 := Hbase.NewGetRowWithColumnsTsArgs() err1717 := containerStruct4.ReadField5(jsProt1716) if err1717 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.GetRowWithColumnsTs(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "getRows": if flag.NArg()-1 != 3 { fmt.Fprint(os.Stderr, "GetRows requires 3 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg1719 := flag.Arg(2) mbTrans1720 := thrift.NewTMemoryBufferLen(len(arg1719)) defer mbTrans1720.Close() _, err1721 := mbTrans1720.WriteString(arg1719) if err1721 != nil { Usage() return } factory1722 := thrift.NewTSimpleJSONProtocolFactory() jsProt1723 := factory1722.GetProtocol(mbTrans1720) containerStruct1 := Hbase.NewGetRowsArgs() err1724 := containerStruct1.ReadField2(jsProt1723) if err1724 != nil { Usage() return } argvalue1 := containerStruct1.Rows value1 := argvalue1 arg1725 := flag.Arg(3) mbTrans1726 := thrift.NewTMemoryBufferLen(len(arg1725)) defer mbTrans1726.Close() _, err1727 := mbTrans1726.WriteString(arg1725) if err1727 != nil { Usage() return } factory1728 := thrift.NewTSimpleJSONProtocolFactory() jsProt1729 := factory1728.GetProtocol(mbTrans1726) containerStruct2 := Hbase.NewGetRowsArgs() err1730 := containerStruct2.ReadField3(jsProt1729) if err1730 != nil { Usage() return } argvalue2 := containerStruct2.Attributes value2 := argvalue2 fmt.Print(client.GetRows(value0, value1, value2)) fmt.Print("\n") break case "getRowsWithColumns": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "GetRowsWithColumns requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg1732 := flag.Arg(2) mbTrans1733 := thrift.NewTMemoryBufferLen(len(arg1732)) defer mbTrans1733.Close() _, err1734 := mbTrans1733.WriteString(arg1732) if err1734 != nil { Usage() return } factory1735 := thrift.NewTSimpleJSONProtocolFactory() jsProt1736 := factory1735.GetProtocol(mbTrans1733) containerStruct1 := Hbase.NewGetRowsWithColumnsArgs() err1737 := containerStruct1.ReadField2(jsProt1736) if err1737 != nil { Usage() return } argvalue1 := containerStruct1.Rows value1 := argvalue1 arg1738 := flag.Arg(3) mbTrans1739 := thrift.NewTMemoryBufferLen(len(arg1738)) defer mbTrans1739.Close() _, err1740 := mbTrans1739.WriteString(arg1738) if err1740 != nil { Usage() return } factory1741 := thrift.NewTSimpleJSONProtocolFactory() jsProt1742 := factory1741.GetProtocol(mbTrans1739) containerStruct2 := Hbase.NewGetRowsWithColumnsArgs() err1743 := containerStruct2.ReadField3(jsProt1742) if err1743 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 arg1744 := flag.Arg(4) mbTrans1745 := thrift.NewTMemoryBufferLen(len(arg1744)) defer mbTrans1745.Close() _, err1746 := mbTrans1745.WriteString(arg1744) if err1746 != nil { Usage() return } factory1747 := thrift.NewTSimpleJSONProtocolFactory() jsProt1748 := factory1747.GetProtocol(mbTrans1745) containerStruct3 := Hbase.NewGetRowsWithColumnsArgs() err1749 := containerStruct3.ReadField4(jsProt1748) if err1749 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.GetRowsWithColumns(value0, value1, value2, value3)) fmt.Print("\n") break case "getRowsTs": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "GetRowsTs requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg1751 := flag.Arg(2) mbTrans1752 := thrift.NewTMemoryBufferLen(len(arg1751)) defer mbTrans1752.Close() _, err1753 := mbTrans1752.WriteString(arg1751) if err1753 != nil { Usage() return } factory1754 := thrift.NewTSimpleJSONProtocolFactory() jsProt1755 := factory1754.GetProtocol(mbTrans1752) containerStruct1 := Hbase.NewGetRowsTsArgs() err1756 := containerStruct1.ReadField2(jsProt1755) if err1756 != nil { Usage() return } argvalue1 := containerStruct1.Rows value1 := argvalue1 argvalue2, err1757 := (strconv.ParseInt(flag.Arg(3), 10, 64)) if err1757 != nil { Usage() return } value2 := argvalue2 arg1758 := flag.Arg(4) mbTrans1759 := thrift.NewTMemoryBufferLen(len(arg1758)) defer mbTrans1759.Close() _, err1760 := mbTrans1759.WriteString(arg1758) if err1760 != nil { Usage() return } factory1761 := thrift.NewTSimpleJSONProtocolFactory() jsProt1762 := factory1761.GetProtocol(mbTrans1759) containerStruct3 := Hbase.NewGetRowsTsArgs() err1763 := containerStruct3.ReadField4(jsProt1762) if err1763 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.GetRowsTs(value0, value1, value2, value3)) fmt.Print("\n") break case "getRowsWithColumnsTs": if flag.NArg()-1 != 5 { fmt.Fprint(os.Stderr, "GetRowsWithColumnsTs requires 5 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg1765 := flag.Arg(2) mbTrans1766 := thrift.NewTMemoryBufferLen(len(arg1765)) defer mbTrans1766.Close() _, err1767 := mbTrans1766.WriteString(arg1765) if err1767 != nil { Usage() return } factory1768 := thrift.NewTSimpleJSONProtocolFactory() jsProt1769 := factory1768.GetProtocol(mbTrans1766) containerStruct1 := Hbase.NewGetRowsWithColumnsTsArgs() err1770 := containerStruct1.ReadField2(jsProt1769) if err1770 != nil { Usage() return } argvalue1 := containerStruct1.Rows value1 := argvalue1 arg1771 := flag.Arg(3) mbTrans1772 := thrift.NewTMemoryBufferLen(len(arg1771)) defer mbTrans1772.Close() _, err1773 := mbTrans1772.WriteString(arg1771) if err1773 != nil { Usage() return } factory1774 := thrift.NewTSimpleJSONProtocolFactory() jsProt1775 := factory1774.GetProtocol(mbTrans1772) containerStruct2 := Hbase.NewGetRowsWithColumnsTsArgs() err1776 := containerStruct2.ReadField3(jsProt1775) if err1776 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 argvalue3, err1777 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err1777 != nil { Usage() return } value3 := argvalue3 arg1778 := flag.Arg(5) mbTrans1779 := thrift.NewTMemoryBufferLen(len(arg1778)) defer mbTrans1779.Close() _, err1780 := mbTrans1779.WriteString(arg1778) if err1780 != nil { Usage() return } factory1781 := thrift.NewTSimpleJSONProtocolFactory() jsProt1782 := factory1781.GetProtocol(mbTrans1779) containerStruct4 := Hbase.NewGetRowsWithColumnsTsArgs() err1783 := containerStruct4.ReadField5(jsProt1782) if err1783 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.GetRowsWithColumnsTs(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "mutateRow": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "MutateRow requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg1786 := flag.Arg(3) mbTrans1787 := thrift.NewTMemoryBufferLen(len(arg1786)) defer mbTrans1787.Close() _, err1788 := mbTrans1787.WriteString(arg1786) if err1788 != nil { Usage() return } factory1789 := thrift.NewTSimpleJSONProtocolFactory() jsProt1790 := factory1789.GetProtocol(mbTrans1787) containerStruct2 := Hbase.NewMutateRowArgs() err1791 := containerStruct2.ReadField3(jsProt1790) if err1791 != nil { Usage() return } argvalue2 := containerStruct2.Mutations value2 := argvalue2 arg1792 := flag.Arg(4) mbTrans1793 := thrift.NewTMemoryBufferLen(len(arg1792)) defer mbTrans1793.Close() _, err1794 := mbTrans1793.WriteString(arg1792) if err1794 != nil { Usage() return } factory1795 := thrift.NewTSimpleJSONProtocolFactory() jsProt1796 := factory1795.GetProtocol(mbTrans1793) containerStruct3 := Hbase.NewMutateRowArgs() err1797 := containerStruct3.ReadField4(jsProt1796) if err1797 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.MutateRow(value0, value1, value2, value3)) fmt.Print("\n") break case "mutateRowTs": if flag.NArg()-1 != 5 { fmt.Fprint(os.Stderr, "MutateRowTs requires 5 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg1800 := flag.Arg(3) mbTrans1801 := thrift.NewTMemoryBufferLen(len(arg1800)) defer mbTrans1801.Close() _, err1802 := mbTrans1801.WriteString(arg1800) if err1802 != nil { Usage() return } factory1803 := thrift.NewTSimpleJSONProtocolFactory() jsProt1804 := factory1803.GetProtocol(mbTrans1801) containerStruct2 := Hbase.NewMutateRowTsArgs() err1805 := containerStruct2.ReadField3(jsProt1804) if err1805 != nil { Usage() return } argvalue2 := containerStruct2.Mutations value2 := argvalue2 argvalue3, err1806 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err1806 != nil { Usage() return } value3 := argvalue3 arg1807 := flag.Arg(5) mbTrans1808 := thrift.NewTMemoryBufferLen(len(arg1807)) defer mbTrans1808.Close() _, err1809 := mbTrans1808.WriteString(arg1807) if err1809 != nil { Usage() return } factory1810 := thrift.NewTSimpleJSONProtocolFactory() jsProt1811 := factory1810.GetProtocol(mbTrans1808) containerStruct4 := Hbase.NewMutateRowTsArgs() err1812 := containerStruct4.ReadField5(jsProt1811) if err1812 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.MutateRowTs(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "mutateRows": if flag.NArg()-1 != 3 { fmt.Fprint(os.Stderr, "MutateRows requires 3 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg1814 := flag.Arg(2) mbTrans1815 := thrift.NewTMemoryBufferLen(len(arg1814)) defer mbTrans1815.Close() _, err1816 := mbTrans1815.WriteString(arg1814) if err1816 != nil { Usage() return } factory1817 := thrift.NewTSimpleJSONProtocolFactory() jsProt1818 := factory1817.GetProtocol(mbTrans1815) containerStruct1 := Hbase.NewMutateRowsArgs() err1819 := containerStruct1.ReadField2(jsProt1818) if err1819 != nil { Usage() return } argvalue1 := containerStruct1.RowBatches value1 := argvalue1 arg1820 := flag.Arg(3) mbTrans1821 := thrift.NewTMemoryBufferLen(len(arg1820)) defer mbTrans1821.Close() _, err1822 := mbTrans1821.WriteString(arg1820) if err1822 != nil { Usage() return } factory1823 := thrift.NewTSimpleJSONProtocolFactory() jsProt1824 := factory1823.GetProtocol(mbTrans1821) containerStruct2 := Hbase.NewMutateRowsArgs() err1825 := containerStruct2.ReadField3(jsProt1824) if err1825 != nil { Usage() return } argvalue2 := containerStruct2.Attributes value2 := argvalue2 fmt.Print(client.MutateRows(value0, value1, value2)) fmt.Print("\n") break case "mutateRowsTs": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "MutateRowsTs requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg1827 := flag.Arg(2) mbTrans1828 := thrift.NewTMemoryBufferLen(len(arg1827)) defer mbTrans1828.Close() _, err1829 := mbTrans1828.WriteString(arg1827) if err1829 != nil { Usage() return } factory1830 := thrift.NewTSimpleJSONProtocolFactory() jsProt1831 := factory1830.GetProtocol(mbTrans1828) containerStruct1 := Hbase.NewMutateRowsTsArgs() err1832 := containerStruct1.ReadField2(jsProt1831) if err1832 != nil { Usage() return } argvalue1 := containerStruct1.RowBatches value1 := argvalue1 argvalue2, err1833 := (strconv.ParseInt(flag.Arg(3), 10, 64)) if err1833 != nil { Usage() return } value2 := argvalue2 arg1834 := flag.Arg(4) mbTrans1835 := thrift.NewTMemoryBufferLen(len(arg1834)) defer mbTrans1835.Close() _, err1836 := mbTrans1835.WriteString(arg1834) if err1836 != nil { Usage() return } factory1837 := thrift.NewTSimpleJSONProtocolFactory() jsProt1838 := factory1837.GetProtocol(mbTrans1835) containerStruct3 := Hbase.NewMutateRowsTsArgs() err1839 := containerStruct3.ReadField4(jsProt1838) if err1839 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.MutateRowsTs(value0, value1, value2, value3)) fmt.Print("\n") break case "atomicIncrement": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "AtomicIncrement requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) argvalue3, err1843 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err1843 != nil { Usage() return } value3 := argvalue3 fmt.Print(client.AtomicIncrement(value0, value1, value2, value3)) fmt.Print("\n") break case "deleteAll": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "DeleteAll requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) arg1847 := flag.Arg(4) mbTrans1848 := thrift.NewTMemoryBufferLen(len(arg1847)) defer mbTrans1848.Close() _, err1849 := mbTrans1848.WriteString(arg1847) if err1849 != nil { Usage() return } factory1850 := thrift.NewTSimpleJSONProtocolFactory() jsProt1851 := factory1850.GetProtocol(mbTrans1848) containerStruct3 := Hbase.NewDeleteAllArgs() err1852 := containerStruct3.ReadField4(jsProt1851) if err1852 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.DeleteAll(value0, value1, value2, value3)) fmt.Print("\n") break case "deleteAllTs": if flag.NArg()-1 != 5 { fmt.Fprint(os.Stderr, "DeleteAllTs requires 5 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) argvalue3, err1856 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err1856 != nil { Usage() return } value3 := argvalue3 arg1857 := flag.Arg(5) mbTrans1858 := thrift.NewTMemoryBufferLen(len(arg1857)) defer mbTrans1858.Close() _, err1859 := mbTrans1858.WriteString(arg1857) if err1859 != nil { Usage() return } factory1860 := thrift.NewTSimpleJSONProtocolFactory() jsProt1861 := factory1860.GetProtocol(mbTrans1858) containerStruct4 := Hbase.NewDeleteAllTsArgs() err1862 := containerStruct4.ReadField5(jsProt1861) if err1862 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.DeleteAllTs(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "deleteAllRow": if flag.NArg()-1 != 3 { fmt.Fprint(os.Stderr, "DeleteAllRow requires 3 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg1865 := flag.Arg(3) mbTrans1866 := thrift.NewTMemoryBufferLen(len(arg1865)) defer mbTrans1866.Close() _, err1867 := mbTrans1866.WriteString(arg1865) if err1867 != nil { Usage() return } factory1868 := thrift.NewTSimpleJSONProtocolFactory() jsProt1869 := factory1868.GetProtocol(mbTrans1866) containerStruct2 := Hbase.NewDeleteAllRowArgs() err1870 := containerStruct2.ReadField3(jsProt1869) if err1870 != nil { Usage() return } argvalue2 := containerStruct2.Attributes value2 := argvalue2 fmt.Print(client.DeleteAllRow(value0, value1, value2)) fmt.Print("\n") break case "increment": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "Increment requires 1 args\n") flag.Usage() } arg1871 := flag.Arg(1) mbTrans1872 := thrift.NewTMemoryBufferLen(len(arg1871)) defer mbTrans1872.Close() _, err1873 := mbTrans1872.WriteString(arg1871) if err1873 != nil { Usage() return } factory1874 := thrift.NewTSimpleJSONProtocolFactory() jsProt1875 := factory1874.GetProtocol(mbTrans1872) argvalue0 := Hbase.NewTIncrement() err1876 := argvalue0.Read(jsProt1875) if err1876 != nil { Usage() return } value0 := argvalue0 fmt.Print(client.Increment(value0)) fmt.Print("\n") break case "incrementRows": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "IncrementRows requires 1 args\n") flag.Usage() } arg1877 := flag.Arg(1) mbTrans1878 := thrift.NewTMemoryBufferLen(len(arg1877)) defer mbTrans1878.Close() _, err1879 := mbTrans1878.WriteString(arg1877) if err1879 != nil { Usage() return } factory1880 := thrift.NewTSimpleJSONProtocolFactory() jsProt1881 := factory1880.GetProtocol(mbTrans1878) containerStruct0 := Hbase.NewIncrementRowsArgs() err1882 := containerStruct0.ReadField1(jsProt1881) if err1882 != nil { Usage() return } argvalue0 := containerStruct0.Increments value0 := argvalue0 fmt.Print(client.IncrementRows(value0)) fmt.Print("\n") break case "deleteAllRowTs": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "DeleteAllRowTs requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2, err1885 := (strconv.ParseInt(flag.Arg(3), 10, 64)) if err1885 != nil { Usage() return } value2 := argvalue2 arg1886 := flag.Arg(4) mbTrans1887 := thrift.NewTMemoryBufferLen(len(arg1886)) defer mbTrans1887.Close() _, err1888 := mbTrans1887.WriteString(arg1886) if err1888 != nil { Usage() return } factory1889 := thrift.NewTSimpleJSONProtocolFactory() jsProt1890 := factory1889.GetProtocol(mbTrans1887) containerStruct3 := Hbase.NewDeleteAllRowTsArgs() err1891 := containerStruct3.ReadField4(jsProt1890) if err1891 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.DeleteAllRowTs(value0, value1, value2, value3)) fmt.Print("\n") break case "scannerOpenWithScan": if flag.NArg()-1 != 3 { fmt.Fprint(os.Stderr, "ScannerOpenWithScan requires 3 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) arg1893 := flag.Arg(2) mbTrans1894 := thrift.NewTMemoryBufferLen(len(arg1893)) defer mbTrans1894.Close() _, err1895 := mbTrans1894.WriteString(arg1893) if err1895 != nil { Usage() return } factory1896 := thrift.NewTSimpleJSONProtocolFactory() jsProt1897 := factory1896.GetProtocol(mbTrans1894) argvalue1 := Hbase.NewTScan() err1898 := argvalue1.Read(jsProt1897) if err1898 != nil { Usage() return } value1 := argvalue1 arg1899 := flag.Arg(3) mbTrans1900 := thrift.NewTMemoryBufferLen(len(arg1899)) defer mbTrans1900.Close() _, err1901 := mbTrans1900.WriteString(arg1899) if err1901 != nil { Usage() return } factory1902 := thrift.NewTSimpleJSONProtocolFactory() jsProt1903 := factory1902.GetProtocol(mbTrans1900) containerStruct2 := Hbase.NewScannerOpenWithScanArgs() err1904 := containerStruct2.ReadField3(jsProt1903) if err1904 != nil { Usage() return } argvalue2 := containerStruct2.Attributes value2 := argvalue2 fmt.Print(client.ScannerOpenWithScan(value0, value1, value2)) fmt.Print("\n") break case "scannerOpen": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "ScannerOpen requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg1907 := flag.Arg(3) mbTrans1908 := thrift.NewTMemoryBufferLen(len(arg1907)) defer mbTrans1908.Close() _, err1909 := mbTrans1908.WriteString(arg1907) if err1909 != nil { Usage() return } factory1910 := thrift.NewTSimpleJSONProtocolFactory() jsProt1911 := factory1910.GetProtocol(mbTrans1908) containerStruct2 := Hbase.NewScannerOpenArgs() err1912 := containerStruct2.ReadField3(jsProt1911) if err1912 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 arg1913 := flag.Arg(4) mbTrans1914 := thrift.NewTMemoryBufferLen(len(arg1913)) defer mbTrans1914.Close() _, err1915 := mbTrans1914.WriteString(arg1913) if err1915 != nil { Usage() return } factory1916 := thrift.NewTSimpleJSONProtocolFactory() jsProt1917 := factory1916.GetProtocol(mbTrans1914) containerStruct3 := Hbase.NewScannerOpenArgs() err1918 := containerStruct3.ReadField4(jsProt1917) if err1918 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.ScannerOpen(value0, value1, value2, value3)) fmt.Print("\n") break case "scannerOpenWithStop": if flag.NArg()-1 != 5 { fmt.Fprint(os.Stderr, "ScannerOpenWithStop requires 5 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) arg1922 := flag.Arg(4) mbTrans1923 := thrift.NewTMemoryBufferLen(len(arg1922)) defer mbTrans1923.Close() _, err1924 := mbTrans1923.WriteString(arg1922) if err1924 != nil { Usage() return } factory1925 := thrift.NewTSimpleJSONProtocolFactory() jsProt1926 := factory1925.GetProtocol(mbTrans1923) containerStruct3 := Hbase.NewScannerOpenWithStopArgs() err1927 := containerStruct3.ReadField4(jsProt1926) if err1927 != nil { Usage() return } argvalue3 := containerStruct3.Columns value3 := argvalue3 arg1928 := flag.Arg(5) mbTrans1929 := thrift.NewTMemoryBufferLen(len(arg1928)) defer mbTrans1929.Close() _, err1930 := mbTrans1929.WriteString(arg1928) if err1930 != nil { Usage() return } factory1931 := thrift.NewTSimpleJSONProtocolFactory() jsProt1932 := factory1931.GetProtocol(mbTrans1929) containerStruct4 := Hbase.NewScannerOpenWithStopArgs() err1933 := containerStruct4.ReadField5(jsProt1932) if err1933 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.ScannerOpenWithStop(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "scannerOpenWithPrefix": if flag.NArg()-1 != 4 { fmt.Fprint(os.Stderr, "ScannerOpenWithPrefix requires 4 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg1936 := flag.Arg(3) mbTrans1937 := thrift.NewTMemoryBufferLen(len(arg1936)) defer mbTrans1937.Close() _, err1938 := mbTrans1937.WriteString(arg1936) if err1938 != nil { Usage() return } factory1939 := thrift.NewTSimpleJSONProtocolFactory() jsProt1940 := factory1939.GetProtocol(mbTrans1937) containerStruct2 := Hbase.NewScannerOpenWithPrefixArgs() err1941 := containerStruct2.ReadField3(jsProt1940) if err1941 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 arg1942 := flag.Arg(4) mbTrans1943 := thrift.NewTMemoryBufferLen(len(arg1942)) defer mbTrans1943.Close() _, err1944 := mbTrans1943.WriteString(arg1942) if err1944 != nil { Usage() return } factory1945 := thrift.NewTSimpleJSONProtocolFactory() jsProt1946 := factory1945.GetProtocol(mbTrans1943) containerStruct3 := Hbase.NewScannerOpenWithPrefixArgs() err1947 := containerStruct3.ReadField4(jsProt1946) if err1947 != nil { Usage() return } argvalue3 := containerStruct3.Attributes value3 := argvalue3 fmt.Print(client.ScannerOpenWithPrefix(value0, value1, value2, value3)) fmt.Print("\n") break case "scannerOpenTs": if flag.NArg()-1 != 5 { fmt.Fprint(os.Stderr, "ScannerOpenTs requires 5 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) arg1950 := flag.Arg(3) mbTrans1951 := thrift.NewTMemoryBufferLen(len(arg1950)) defer mbTrans1951.Close() _, err1952 := mbTrans1951.WriteString(arg1950) if err1952 != nil { Usage() return } factory1953 := thrift.NewTSimpleJSONProtocolFactory() jsProt1954 := factory1953.GetProtocol(mbTrans1951) containerStruct2 := Hbase.NewScannerOpenTsArgs() err1955 := containerStruct2.ReadField3(jsProt1954) if err1955 != nil { Usage() return } argvalue2 := containerStruct2.Columns value2 := argvalue2 argvalue3, err1956 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err1956 != nil { Usage() return } value3 := argvalue3 arg1957 := flag.Arg(5) mbTrans1958 := thrift.NewTMemoryBufferLen(len(arg1957)) defer mbTrans1958.Close() _, err1959 := mbTrans1958.WriteString(arg1957) if err1959 != nil { Usage() return } factory1960 := thrift.NewTSimpleJSONProtocolFactory() jsProt1961 := factory1960.GetProtocol(mbTrans1958) containerStruct4 := Hbase.NewScannerOpenTsArgs() err1962 := containerStruct4.ReadField5(jsProt1961) if err1962 != nil { Usage() return } argvalue4 := containerStruct4.Attributes value4 := argvalue4 fmt.Print(client.ScannerOpenTs(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "scannerOpenWithStopTs": if flag.NArg()-1 != 6 { fmt.Fprint(os.Stderr, "ScannerOpenWithStopTs requires 6 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) arg1966 := flag.Arg(4) mbTrans1967 := thrift.NewTMemoryBufferLen(len(arg1966)) defer mbTrans1967.Close() _, err1968 := mbTrans1967.WriteString(arg1966) if err1968 != nil { Usage() return } factory1969 := thrift.NewTSimpleJSONProtocolFactory() jsProt1970 := factory1969.GetProtocol(mbTrans1967) containerStruct3 := Hbase.NewScannerOpenWithStopTsArgs() err1971 := containerStruct3.ReadField4(jsProt1970) if err1971 != nil { Usage() return } argvalue3 := containerStruct3.Columns value3 := argvalue3 argvalue4, err1972 := (strconv.ParseInt(flag.Arg(5), 10, 64)) if err1972 != nil { Usage() return } value4 := argvalue4 arg1973 := flag.Arg(6) mbTrans1974 := thrift.NewTMemoryBufferLen(len(arg1973)) defer mbTrans1974.Close() _, err1975 := mbTrans1974.WriteString(arg1973) if err1975 != nil { Usage() return } factory1976 := thrift.NewTSimpleJSONProtocolFactory() jsProt1977 := factory1976.GetProtocol(mbTrans1974) containerStruct5 := Hbase.NewScannerOpenWithStopTsArgs() err1978 := containerStruct5.ReadField6(jsProt1977) if err1978 != nil { Usage() return } argvalue5 := containerStruct5.Attributes value5 := argvalue5 fmt.Print(client.ScannerOpenWithStopTs(value0, value1, value2, value3, value4, value5)) fmt.Print("\n") break case "scannerGet": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "ScannerGet requires 1 args\n") flag.Usage() } tmp0, err1979 := (strconv.Atoi(flag.Arg(1))) if err1979 != nil { Usage() return } argvalue0 := int32(tmp0) value0 := Hbase.ScannerID(argvalue0) fmt.Print(client.ScannerGet(value0)) fmt.Print("\n") break case "scannerGetList": if flag.NArg()-1 != 2 { fmt.Fprint(os.Stderr, "ScannerGetList requires 2 args\n") flag.Usage() } tmp0, err1980 := (strconv.Atoi(flag.Arg(1))) if err1980 != nil { Usage() return } argvalue0 := int32(tmp0) value0 := Hbase.ScannerID(argvalue0) tmp1, err1981 := (strconv.Atoi(flag.Arg(2))) if err1981 != nil { Usage() return } argvalue1 := int32(tmp1) value1 := argvalue1 fmt.Print(client.ScannerGetList(value0, value1)) fmt.Print("\n") break case "scannerClose": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "ScannerClose requires 1 args\n") flag.Usage() } tmp0, err1982 := (strconv.Atoi(flag.Arg(1))) if err1982 != nil { Usage() return } argvalue0 := int32(tmp0) value0 := Hbase.ScannerID(argvalue0) fmt.Print(client.ScannerClose(value0)) fmt.Print("\n") break case "getRowOrBefore": if flag.NArg()-1 != 3 { fmt.Fprint(os.Stderr, "GetRowOrBefore requires 3 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) argvalue1 := flag.Arg(2) value1 := Hbase.Text(argvalue1) argvalue2 := flag.Arg(3) value2 := Hbase.Text(argvalue2) fmt.Print(client.GetRowOrBefore(value0, value1, value2)) fmt.Print("\n") break case "getRegionInfo": if flag.NArg()-1 != 1 { fmt.Fprint(os.Stderr, "GetRegionInfo requires 1 args\n") flag.Usage() } argvalue0 := flag.Arg(1) value0 := Hbase.Text(argvalue0) fmt.Print(client.GetRegionInfo(value0)) fmt.Print("\n") break case "": Usage() break default: fmt.Fprint(os.Stderr, "Invalid function ", cmd, "\n") } }