func (f *TimestampsFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.TimestampsFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "TimestampsFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
ConstructPBFilter is TODO
package filter
import (
	"errors"
	"github.com/tsuna/gohbase/pb"
	"google.golang.org/protobuf/proto"
)
const filterPath = "org.apache.hadoop.hbase.filter."
type ListOperator int32
func (o ListOperator) isValid() bool {
	return o >= 1 && o <= 2
}
func (o ListOperator) toPB() *pb.FilterList_Operator {
	op := pb.FilterList_Operator(o)
	return &op
}
const (
	MustPassAll ListOperator = 1
	MustPassOne ListOperator = 2
)
type CompareType int32
func (c CompareType) isValid() bool {
	return c >= 0 && c <= 6
}
const (
	Less           CompareType = 0
	LessOrEqual    CompareType = 1
	Equal          CompareType = 2
	NotEqual       CompareType = 3
	GreaterOrEqual CompareType = 4
	Greater        CompareType = 5
	NoOp           CompareType = 6
)
var _ Filter = (*List)(nil)
var _ Filter = (*ColumnCountGetFilter)(nil)
var _ Filter = (*ColumnPaginationFilter)(nil)
var _ Filter = (*ColumnPrefixFilter)(nil)
var _ Filter = (*ColumnRangeFilter)(nil)
var _ Filter = (*CompareFilter)(nil)
var _ Filter = (*DependentColumnFilter)(nil)
var _ Filter = (*FamilyFilter)(nil)
var _ Filter = (*Wrapper)(nil)
var _ Filter = (*FirstKeyOnlyFilter)(nil)
var _ Filter = (*FirstKeyValueMatchingQualifiersFilter)(nil)
var _ Filter = (*FuzzyRowFilter)(nil)
var _ Filter = (*InclusiveStopFilter)(nil)
var _ Filter = (*KeyOnlyFilter)(nil)
var _ Filter = (*MultipleColumnPrefixFilter)(nil)
var _ Filter = (*PageFilter)(nil)
var _ Filter = (*PrefixFilter)(nil)
var _ Filter = (*QualifierFilter)(nil)
var _ Filter = (*RandomRowFilter)(nil)
var _ Filter = (*RowFilter)(nil)
var _ Filter = (*SingleColumnValueFilter)(nil)
var _ Filter = (*SingleColumnValueExcludeFilter)(nil)
var _ Filter = (*SkipFilter)(nil)
var _ Filter = (*TimestampsFilter)(nil)
var _ Filter = (*ValueFilter)(nil)
var _ Filter = (*WhileMatchFilter)(nil)
var _ Filter = (*AllFilter)(nil)
var _ Filter = (*RowRange)(nil)
var _ Filter = (*MultiRowRangeFilter)(nil)
type Filter interface {
	ConstructPBFilter() (*pb.Filter, error)
}
type BytesBytesPair pb.BytesBytesPair
func NewBytesBytesPair(first []byte, second []byte) *BytesBytesPair {
	return &BytesBytesPair{
		First:  first,
		Second: second,
	}
}
type List pb.FilterList
func NewList(operator ListOperator, filters ...Filter) *List {
	f := &List{
		Operator: operator.toPB(),
	}
	f.AddFilters(filters...)
	return f
}
func (f *List) AddFilters(filters ...Filter) {
	for _, filter := range filters {
		fpb, err := filter.ConstructPBFilter()
		if err != nil {
			panic(err)
		}
		f.Filters = append(f.Filters, fpb)
	}
}
func (f *List) ConstructPBFilter() (*pb.Filter, error) {
	if !ListOperator(*f.Operator).isValid() {
		return nil, errors.New("invalid operator specified")
	}
	serializedFilter, err := proto.Marshal((*pb.FilterList)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "FilterList"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type ColumnCountGetFilter pb.ColumnCountGetFilter
func NewColumnCountGetFilter(limit int32) *ColumnCountGetFilter {
	return &ColumnCountGetFilter{
		Limit: proto.Int32(limit),
	}
}
func (f *ColumnCountGetFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.ColumnCountGetFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "ColumnCountGetFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type ColumnPaginationFilter pb.ColumnPaginationFilter
func NewColumnPaginationFilter(limit, offset int32, columnOffset []byte) *ColumnPaginationFilter {
	return &ColumnPaginationFilter{
		Limit:        proto.Int32(limit),
		Offset:       proto.Int32(offset),
		ColumnOffset: columnOffset,
	}
}
func (f *ColumnPaginationFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.ColumnPaginationFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "ColumnPaginationFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type ColumnPrefixFilter pb.ColumnPrefixFilter
func NewColumnPrefixFilter(prefix []byte) *ColumnPrefixFilter {
	return &ColumnPrefixFilter{
		Prefix: prefix,
	}
}
func (f *ColumnPrefixFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.ColumnPrefixFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "ColumnPrefixFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type ColumnRangeFilter pb.ColumnRangeFilter
func NewColumnRangeFilter(minColumn, maxColumn []byte,
	minColumnInclusive, maxColumnInclusive bool) *ColumnRangeFilter {
	return &ColumnRangeFilter{
		MinColumn:          minColumn,
		MaxColumn:          maxColumn,
		MinColumnInclusive: proto.Bool(minColumnInclusive),
		MaxColumnInclusive: proto.Bool(maxColumnInclusive),
	}
}
func (f *ColumnRangeFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.ColumnRangeFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "ColumnRangeFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type CompareFilter pb.CompareFilter
func NewCompareFilter(compareOp CompareType, comparatorObj Comparator) *CompareFilter {
	op := pb.CompareType(compareOp)
	obj, err := comparatorObj.ConstructPBComparator()
	if err != nil {
		panic(err)
	}
	return &CompareFilter{
		CompareOp:  &op,
		Comparator: obj,
	}
}
func (f *CompareFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.CompareFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "CompareFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type DependentColumnFilter pb.DependentColumnFilter
func NewDependentColumnFilter(compareFilter *CompareFilter, columnFamily, columnQualifier []byte,
	dropDependentColumn bool) *DependentColumnFilter {
	return &DependentColumnFilter{
		CompareFilter:       (*pb.CompareFilter)(compareFilter),
		ColumnFamily:        columnFamily,
		ColumnQualifier:     columnQualifier,
		DropDependentColumn: proto.Bool(dropDependentColumn),
	}
}
func (f *DependentColumnFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.DependentColumnFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "DependentColumnFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type FamilyFilter pb.FamilyFilter
func NewFamilyFilter(compareFilter *CompareFilter) *FamilyFilter {
	return &FamilyFilter{
		CompareFilter: (*pb.CompareFilter)(compareFilter),
	}
}
func (f *FamilyFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.FamilyFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "FamilyFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type Wrapper pb.FilterWrapper
func NewWrapper(wrappedFilter Filter) *Wrapper {
	f, err := wrappedFilter.ConstructPBFilter()
	if err != nil {
		panic(err)
	}
	return &Wrapper{
		Filter: f,
	}
}
func (f *Wrapper) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.FilterWrapper)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "FilterWrapper"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type FirstKeyOnlyFilter struct{}
func NewFirstKeyOnlyFilter() FirstKeyOnlyFilter {
	return FirstKeyOnlyFilter{}
}
func (f FirstKeyOnlyFilter) ConstructPBFilter() (*pb.Filter, error) {
	return &pb.Filter{
		Name:             proto.String(filterPath + "FirstKeyOnlyFilter"),
		SerializedFilter: pb.MustMarshal(&pb.FirstKeyOnlyFilter{}),
	}, nil
}
type FirstKeyValueMatchingQualifiersFilter pb.FirstKeyValueMatchingQualifiersFilter
func NewFirstKeyValueMatchingQualifiersFilter(
	qualifiers [][]byte) *FirstKeyValueMatchingQualifiersFilter {
	return &FirstKeyValueMatchingQualifiersFilter{
		Qualifiers: qualifiers,
	}
}
func (f *FirstKeyValueMatchingQualifiersFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.FirstKeyValueMatchingQualifiersFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "FirstKeyValueMatchingQualifiersFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type FuzzyRowFilter pb.FuzzyRowFilter
func NewFuzzyRowFilter(pairs []*BytesBytesPair) *FuzzyRowFilter {
	p := make([]*pb.BytesBytesPair, len(pairs))
	for i, pair := range pairs {
		p[i] = (*pb.BytesBytesPair)(pair)
	}
	return &FuzzyRowFilter{
		FuzzyKeysData: p,
	}
}
func (f *FuzzyRowFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.FuzzyRowFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "FuzzyRowFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type InclusiveStopFilter pb.InclusiveStopFilter
func NewInclusiveStopFilter(stopRowKey []byte) *InclusiveStopFilter {
	return &InclusiveStopFilter{
		StopRowKey: stopRowKey,
	}
}
func (f *InclusiveStopFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.InclusiveStopFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "InclusiveStopFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type KeyOnlyFilter pb.KeyOnlyFilter
func NewKeyOnlyFilter(lenAsVal bool) *KeyOnlyFilter {
	return &KeyOnlyFilter{
		LenAsVal: proto.Bool(lenAsVal),
	}
}
func (f *KeyOnlyFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.KeyOnlyFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "KeyOnlyFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type MultipleColumnPrefixFilter pb.MultipleColumnPrefixFilter
func NewMultipleColumnPrefixFilter(sortedPrefixes [][]byte) *MultipleColumnPrefixFilter {
	return &MultipleColumnPrefixFilter{
		SortedPrefixes: sortedPrefixes,
	}
}
func (f *MultipleColumnPrefixFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.MultipleColumnPrefixFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "MultipleColumnPrefixFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type PageFilter pb.PageFilter
func NewPageFilter(pageSize int64) *PageFilter {
	return &PageFilter{
		PageSize: proto.Int64(pageSize),
	}
}
func (f *PageFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.PageFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "PageFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type PrefixFilter pb.PrefixFilter
func NewPrefixFilter(prefix []byte) *PrefixFilter {
	return &PrefixFilter{
		Prefix: prefix,
	}
}
func (f *PrefixFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.PrefixFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "PrefixFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type QualifierFilter pb.QualifierFilter
func NewQualifierFilter(compareFilter *CompareFilter) *QualifierFilter {
	return &QualifierFilter{
		CompareFilter: (*pb.CompareFilter)(compareFilter),
	}
}
func (f *QualifierFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.QualifierFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "QualifierFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type RandomRowFilter pb.RandomRowFilter
func NewRandomRowFilter(chance float32) *RandomRowFilter {
	return &RandomRowFilter{
		Chance: proto.Float32(chance),
	}
}
func (f *RandomRowFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.RandomRowFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "RandomRowFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type RowFilter pb.RowFilter
func NewRowFilter(compareFilter *CompareFilter) *RowFilter {
	return &RowFilter{
		CompareFilter: (*pb.CompareFilter)(compareFilter),
	}
}
func (f *RowFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.RowFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "RowFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type SingleColumnValueFilter pb.SingleColumnValueFilter
func NewSingleColumnValueFilter(columnFamily, columnQualifier []byte, compareOp CompareType,
	comparatorObj Comparator, filterIfMissing, latestVersionOnly bool) *SingleColumnValueFilter {
	obj, err := comparatorObj.ConstructPBComparator()
	if err != nil {
		panic(err)
	}
	return &SingleColumnValueFilter{
		ColumnFamily:      columnFamily,
		ColumnQualifier:   columnQualifier,
		CompareOp:         (*pb.CompareType)(&compareOp),
		Comparator:        obj,
		FilterIfMissing:   proto.Bool(filterIfMissing),
		LatestVersionOnly: proto.Bool(latestVersionOnly),
	}
}
func (f *SingleColumnValueFilter) ConstructPB() (*pb.SingleColumnValueFilter, error) {
	if !CompareType(*f.CompareOp).isValid() {
		return nil, errors.New("invalid compare operation specified")
	}
	return (*pb.SingleColumnValueFilter)(f), nil
}
func (f *SingleColumnValueFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.SingleColumnValueFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "SingleColumnValueFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type SingleColumnValueExcludeFilter pb.SingleColumnValueExcludeFilter
func NewSingleColumnValueExcludeFilter(
	filter *SingleColumnValueFilter) *SingleColumnValueExcludeFilter {
	return &SingleColumnValueExcludeFilter{
		SingleColumnValueFilter: (*pb.SingleColumnValueFilter)(filter),
	}
}
func (f *SingleColumnValueExcludeFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.SingleColumnValueExcludeFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "SingleColumnValueExcludeFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type SkipFilter pb.SkipFilter
func NewSkipFilter(skippingFilter Filter) *SkipFilter {
	f, err := skippingFilter.ConstructPBFilter()
	if err != nil {
		panic(err)
	}
	return &SkipFilter{
		Filter: f,
	}
}
func (f *SkipFilter) ConstructPBFilter() (*pb.Filter, error) {
	serializedFilter, err := proto.Marshal((*pb.SkipFilter)(f))
	if err != nil {
		return nil, err
	}
	filter := &pb.Filter{
		Name:             proto.String(filterPath + "SkipFilter"),
		SerializedFilter: serializedFilter,
	}
	return filter, nil
}
type TimestampsFilter pb.TimestampsFilter
func NewTimestampsFilter(timestamps []int64) *TimestampsFilter {
	return &TimestampsFilter{
		Timestamps: timestamps,
	}
}