// Code generated by the FlatBuffers compiler. DO NOT EDIT.

package gamma_api

import (
	flatbuffers "github.com/google/flatbuffers/go"
)

type SearchResult struct {
	_tab flatbuffers.Table
}

func GetRootAsSearchResult(buf []byte, offset flatbuffers.UOffsetT) *SearchResult {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &SearchResult{}
	x.Init(buf, n+offset)
	return x
}

func GetSizePrefixedRootAsSearchResult(buf []byte, offset flatbuffers.UOffsetT) *SearchResult {
	n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
	x := &SearchResult{}
	x.Init(buf, n+offset+flatbuffers.SizeUint32)
	return x
}

func (rcv *SearchResult) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *SearchResult) Table() flatbuffers.Table {
	return rcv._tab
}

func (rcv *SearchResult) Total() int32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return rcv._tab.GetInt32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *SearchResult) MutateTotal(n int32) bool {
	return rcv._tab.MutateInt32Slot(4, n)
}

func (rcv *SearchResult) ResultCode() SearchResultCode {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		return SearchResultCode(rcv._tab.GetInt8(o + rcv._tab.Pos))
	}
	return 0
}

func (rcv *SearchResult) MutateResultCode(n SearchResultCode) bool {
	return rcv._tab.MutateInt8Slot(6, int8(n))
}

func (rcv *SearchResult) Msg() []byte {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
	if o != 0 {
		return rcv._tab.ByteVector(o + rcv._tab.Pos)
	}
	return nil
}

func (rcv *SearchResult) ResultItems(obj *ResultItem, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *SearchResult) ResultItemsLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func SearchResultStart(builder *flatbuffers.Builder) {
	builder.StartObject(4)
}
func SearchResultAddTotal(builder *flatbuffers.Builder, total int32) {
	builder.PrependInt32Slot(0, total, 0)
}
func SearchResultAddResultCode(builder *flatbuffers.Builder, resultCode SearchResultCode) {
	builder.PrependInt8Slot(1, int8(resultCode), 0)
}
func SearchResultAddMsg(builder *flatbuffers.Builder, msg flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(msg), 0)
}
func SearchResultAddResultItems(builder *flatbuffers.Builder, resultItems flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(resultItems), 0)
}
func SearchResultStartResultItemsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func SearchResultEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}
