package hbase is a native hbase client library for Golang.
Most of codes are automatically generated by thrift 0.9.2 [1] with hbase IDL.
Hbase >= 1.1.2
This version of hbase is in the latest stable release line of hbase comminuty [2].
go get github.com/csigo/hbase
package main
import (
"fmt"
"log"
)
func main() {
mockServer := &MockHbase{}
mockServer.On("IsTableEnabled", Bytes("existTable")).Return(true, nil)
srv, err := NewHbaseServer(mockServer)
if err != nil {
log.Fatal(err)
}
defer srv.Stop()
connFactory := ThriftClientFactory(
fmt.Sprintf("127.0.0.1:%d", srv.Port))
rawConn, err := connFactory()
if err != nil {
log.Fatal(err)
}
defer rawConn.Close()
hConn := NewConn(rawConn)
shouldBeTrue, err := hConn.IsTableEnabled(Bytes("existTable"))
if err != nil {
log.Fatal(err)
}
if !shouldBeTrue {
log.Fatalf("should be true, but got false")
}
}