Skip to content

csigo/hbase

Repository files navigation

hbase

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.

Versions

Hbase >= 1.1.2

This version of hbase is in the latest stable release line of hbase comminuty [2].

Installation

go get github.com/csigo/hbase

Example


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")
        }
}


Reference

[1] https://github.com/apache/thrift

[2] https://github.com/apache/hbase

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published