# README
database/hbase
项目简介
Hbase Client,进行封装加入了链路追踪和统计。
usage
package main
import (
"context"
"fmt"
"github.com/HuJingwei/go-zero/pkg/database/hbase"
)
func main() {
config := &hbase.Config{Zookeeper: &hbase.ZKConfig{Addrs: []string{"localhost"}}}
client := hbase.NewClient(config)
values := map[string]map[string][]byte{"name": {"firstname": []byte("hello"), "lastname": []byte("world")}}
ctx := context.Background()
_, err := client.PutStr(ctx, "user", "user1", values)
if err != nil {
panic(err)
}
result, err := client.GetStr(ctx, "user", "user1")
if err != nil {
panic(err)
}
fmt.Printf("%v", result)
}
依赖包
1.gohbase
# Functions
MetricsHook if stats is nil use stat.DB as default.
NewClient new a hbase client.
NewRawClient new a hbase client without prometheus metrics and dapper trace hook.
NewSlowLogHook log slow operation.
TraceHook create new hbase trace hook.
# Type aliases
HookFunc hook function call before every method and hook return function will call after finish.