You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
752 B
41 lines
752 B
6 years ago
|
### database/hbase
|
||
|
|
||
|
### 项目简介
|
||
|
|
||
|
Hbase Client,进行封装加入了链路追踪和统计。
|
||
|
|
||
|
### usage
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
|
||
6 years ago
|
"github.com/bilibili/kratos/pkg/database/hbase"
|
||
6 years ago
|
)
|
||
|
|
||
|
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)
|
||
|
}
|
||
|
```
|
||
|
|
||
|
##### 依赖包
|
||
|
|
||
6 years ago
|
1.[gohbase](https://github.com/tsuna/gohbase)
|