github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/pingcap/go-hbase/types.go (about)

     1  package hbase
     2  
     3  import "bytes"
     4  
     5  type Type byte
     6  
     7  const (
     8  	TypeMinimum             = Type(0)
     9  	TypePut                 = Type(4)
    10  	TypeDelete              = Type(8)
    11  	TypeDeleteFamilyVersion = Type(10)
    12  	TypeDeleteColumn        = Type(12)
    13  	TypeDeleteFamily        = Type(14)
    14  	TypeMaximum             = Type(0xff)
    15  )
    16  
    17  type set map[string]struct{}
    18  
    19  func newSet() set {
    20  	return set(map[string]struct{}{})
    21  }
    22  
    23  func (s set) exists(k string) bool {
    24  	_, ok := s[k]
    25  	return ok
    26  }
    27  
    28  func (s set) add(k string) {
    29  	s[k] = struct{}{}
    30  }
    31  
    32  func (s set) remove(k string) {
    33  	delete(s, k)
    34  }
    35  
    36  type BytesSlice [][]byte
    37  
    38  func (s BytesSlice) Len() int           { return len(s) }
    39  func (s BytesSlice) Less(i, j int) bool { return bytes.Compare(s[i], s[j]) < 0 }
    40  func (s BytesSlice) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }