-
Notifications
You must be signed in to change notification settings - Fork 0
/
hbaseManager.go
49 lines (41 loc) · 870 Bytes
/
hbaseManager.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"fmt"
"github.com/sdming/goh"
"github.com/sdming/goh/Hbase"
)
func CreateHbaseTable(table string, cf []string ) bool{
fmt.Println(table)
cols := make([]*goh.ColumnDescriptor, len(cf))
for k, v := range cf {
cols[k] = goh.NewColumnDescriptorDefault(v)
}
exists, err := hclient.CreateTable(table, cols)
if err != nil {
fmt.Println(err)
return false
}
if exists {
fmt.Printf("%s Exists", table)
} else {
fmt.Printf("Create %s successful", table)
}
return true
}
func ReadHbaseData(table string, row string) {
//TO-DO
}
func UpdateHbaseData(table string, row []byte) {
//TO-DO
}
func UpdateHbaseBatchData(table string, rows []*Hbase.BatchMutation, attr map[string]string) bool{
err := hclient.MutateRows(table, rows, attr)
if err != nil {
return false
} else {
return true
}
}
func DeleteHbaseData() {
//TO-DO
}