# automatically generated by the FlatBuffers compiler, do not modify

# namespace: dataprotocol

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class SQLResponseColumns(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = SQLResponseColumns()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsSQLResponseColumns(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # SQLResponseColumns
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # SQLResponseColumns
    def Columns(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from tablestore.flatbuffer.dataprotocol.SQLResponseColumn import SQLResponseColumn
            obj = SQLResponseColumn()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SQLResponseColumns
    def ColumnsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SQLResponseColumns
    def ColumnsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

    # SQLResponseColumns
    def RowCount(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
        return 0

def SQLResponseColumnsStart(builder): builder.StartObject(2)
def Start(builder):
    return SQLResponseColumnsStart(builder)
def SQLResponseColumnsAddColumns(builder, columns): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(columns), 0)
def AddColumns(builder, columns):
    return SQLResponseColumnsAddColumns(builder, columns)
def SQLResponseColumnsStartColumnsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartColumnsVector(builder, numElems):
    return SQLResponseColumnsStartColumnsVector(builder, numElems)
def SQLResponseColumnsAddRowCount(builder, rowCount): builder.PrependInt64Slot(1, rowCount, 0)
def AddRowCount(builder, rowCount):
    return SQLResponseColumnsAddRowCount(builder, rowCount)
def SQLResponseColumnsEnd(builder): return builder.EndObject()
def End(builder):
    return SQLResponseColumnsEnd(builder)