github.com/tsuna/gohbase@v0.0.0-20250731002811-4ffcadfba63e/README.md (about)

     1  # Golang HBase client [![CI](https://github.com/tsuna/gohbase/actions/workflows/ci.yml/badge.svg)](https://github.com/tsuna/gohbase/actions/workflows/ci.yml) [![codecov.io](http://codecov.io/github/tsuna/gohbase/coverage.svg?branch=master)](http://codecov.io/github/tsuna/gohbase?branch=master) [![GoDoc](https://godoc.org/github.com/tsuna/gohbase?status.png)](https://godoc.org/github.com/tsuna/gohbase)
     2  
     3  This is a pure [Go](http://golang.org/) client for [HBase](http://hbase.org).
     4  
     5  Current status: beta.
     6  
     7  ## Supported Versions
     8  
     9  HBase >= 1.0
    10  
    11  ## Installation
    12  
    13      go get github.com/tsuna/gohbase
    14  
    15  ## Example Usage
    16  
    17  #### Create a client
    18  ```go
    19  client := gohbase.NewClient("localhost")
    20  ```
    21  #### Insert a cell
    22  ```go
    23  // Values maps a ColumnFamily -> Qualifiers -> Values.
    24  values := map[string]map[string][]byte{"cf": map[string][]byte{"a": []byte{0}}}
    25  putRequest, err := hrpc.NewPutStr(context.Background(), "table", "key", values)
    26  rsp, err := client.Put(putRequest)
    27  ```
    28  
    29  #### Get an entire row
    30  ```go
    31  getRequest, err := hrpc.NewGetStr(context.Background(), "table", "row")
    32  getRsp, err := client.Get(getRequest)
    33  ```
    34  
    35  #### Get a specific cell
    36  ```go
    37  // Perform a get for the cell with key "15", column family "cf" and qualifier "a"
    38  family := map[string][]string{"cf": []string{"a"}}
    39  getRequest, err := hrpc.NewGetStr(context.Background(), "table", "15",
    40      hrpc.Families(family))
    41  getRsp, err := client.Get(getRequest)
    42  ```
    43  
    44  #### Get a specific cell with a filter
    45  ```go
    46  pFilter := filter.NewKeyOnlyFilter(true)
    47  family := map[string][]string{"cf": []string{"a"}}
    48  getRequest, err := hrpc.NewGetStr(context.Background(), "table", "15",
    49      hrpc.Families(family), hrpc.Filters(pFilter))
    50  getRsp, err := client.Get(getRequest)
    51  ```
    52  
    53  #### Scan with a filter
    54  ```go
    55  pFilter := filter.NewPrefixFilter([]byte("7"))
    56  scanRequest, err := hrpc.NewScanStr(context.Background(), "table",
    57  		hrpc.Filters(pFilter))
    58  scanRsp, err := client.Scan(scanRequest)
    59  ```
    60  
    61  ## Contributing
    62  
    63  Any help would be appreciated. Please use Github pull requests
    64  to send changes for review. Please sign the
    65  [Contributor License Agreement](https://docs.google.com/spreadsheet/viewform?formkey=dFNiOFROLXJBbFBmMkQtb1hNMWhUUnc6MQ)
    66  when you send your first change for review.  
    67  
    68  ## License
    69  
    70  Copyright © 2015 The GoHBase Authors. All rights reserved. Use of this source code is governed by the Apache License 2.0 that can be found in the [COPYING](COPYING) file.