func NewQueryOption() *TGQueryOptionImpl {
	newQryOption := DefaultQueryOption()
	newQryOption.mutable = true
	newQryOption.preloadQueryOptions()
	return newQryOption
}
func NewQueryOption(mutable bool) *TGQueryOptionImpl {
package impl
import (
	"bytes"
	"encoding/gob"
	"fmt"
	"strconv"
	"strings"
	"tgdb"
	"time"
)
type ResultSet struct {
	conn       tgdb.TGConnection
	currPos    int
	isOpen     bool
	resultId   int
	ResultList []interface{}
	MetaData	tgdb.TGResultSetMetaData
}
func DefaultResultSet() *ResultSet {
	gob.Register(ResultSet{})
	newResults := ResultSet{
		currPos:    -1,
		isOpen:     true,
		resultId:   -1,
		ResultList: make([]interface{}, 0),
		MetaData: nil,
	}
	return &newResults
}
var _ tgdb.TGResultSet = (*ResultSet)(nil)
func NewResultSet(conn tgdb.TGConnection, resultId int) *ResultSet {
	newResults := DefaultResultSet()
	newResults.conn = conn
	newResults.resultId = resultId
	return newResults
}
func (obj *ResultSet) GetConnection() tgdb.TGConnection {
	return obj.conn
}
func (obj *ResultSet) GetCurrentPos() int {
	return obj.currPos
}
func (obj *ResultSet) GetIsOpen() bool {
	return obj.isOpen
}
func (obj *ResultSet) GetResultId() int {
	return obj.resultId
}
func (obj *ResultSet) GetResults() []interface{} {
	return obj.ResultList
}
func (obj *ResultSet) AddEntityToResultSet(entity tgdb.TGEntity) tgdb.TGResultSet {
	obj.ResultList = append(obj.ResultList, entity)
	return obj
}
func (obj *ResultSet) Close() tgdb.TGResultSet {
	obj.isOpen = false
	return obj
}
func (obj *ResultSet) Count() int {
	if obj.isOpen == false {
		return 0
	}
	return len(obj.ResultList)
}
func (obj *ResultSet) First() interface{} {
	if obj.isOpen == false {
		return nil
	}
	if len(obj.ResultList) == 0 {
		return nil
	}
	return obj.ResultList[0]
}
func (obj *ResultSet) Last() interface{} {
	if obj.isOpen == false {
		return nil
	}
	if len(obj.ResultList) == 0 {
		return nil
	}
	return obj.ResultList[len(obj.ResultList)-1]
}
func (obj *ResultSet) GetAt(position int) interface{} {
	if obj.isOpen == false {
		return nil
	}
	if position >= 0 && position < len(obj.ResultList) {
		return obj.ResultList[position]
	}
	return nil
}
func (obj *ResultSet) GetExceptions() []tgdb.TGError {
	return nil
}
func (obj *ResultSet) GetPosition() int {
	if obj.isOpen == false {
		return 0
	}
	return obj.currPos
}
func (obj *ResultSet) HasExceptions() bool {
	return false
}
func (obj *ResultSet) HasNext() bool {
	if obj.isOpen == false {
		return false
	}
	if len(obj.ResultList) == 0 {
		return false
	} else if obj.currPos < (len(obj.ResultList)-1) {
		return true
	}
	return false
}
func (obj *ResultSet) Next() interface{} {
	if obj.isOpen == false {
		return nil
	}
	if len(obj.ResultList) == 0 {
		return nil
	} else if obj.currPos < (len(obj.ResultList)-1) {
		obj.currPos++
		return obj.ResultList[obj.currPos]
	}
	return nil
}
func (obj *ResultSet) Prev() interface{} {
	if obj.isOpen == false {
		return nil
	}
	if obj.currPos > 0 {
		obj.currPos--
		return obj.ResultList[obj.currPos]
	}
	return nil
}
func (obj *ResultSet) Skip(position int) tgdb.TGResultSet {
	if obj.isOpen == false {
		return obj
	}
	newPos := obj.currPos + position
	if newPos >= 0 && newPos < len(obj.ResultList) {
		obj.currPos = newPos
	}
	return obj
}
func (obj *ResultSet) ToCollection() []interface{} {
	return obj.ResultList
}
func (obj *ResultSet) String() string {
	var buffer bytes.Buffer
	buffer.WriteString("ResultSet:{")
	buffer.WriteString(fmt.Sprintf("Connection: %+v", obj.conn))
	buffer.WriteString(fmt.Sprintf(", currPos: %+v", obj.currPos))
	buffer.WriteString(fmt.Sprintf(", isOpen: %+v", obj.isOpen))
	buffer.WriteString(fmt.Sprintf(", ResultId: %+v", obj.resultId))
	buffer.WriteString(fmt.Sprintf(", ResultList: %+v", obj.ResultList))
	buffer.WriteString("}")
	return buffer.String()
}
func (obj *ResultSet) MarshalBinary() ([]byte, error) {
	var b bytes.Buffer
	_, err := fmt.Fprintln(&b, obj.conn, obj.currPos, obj.isOpen, obj.resultId, obj.ResultList)
	if err != nil {
		logger.Error(fmt.Sprintf("ERROR: Returning ResultSet:MarshalBinary w/ Error: '%+v'", err.Error()))
		return nil, err
	}
	return b.Bytes(), nil
}
func (obj *ResultSet) UnmarshalBinary(data []byte) error {
	b := bytes.NewBuffer(data)
	_, err := fmt.Fscanln(b, &obj.conn, &obj.currPos, &obj.isOpen, &obj.resultId, &obj.ResultList)
	if err != nil {
		logger.Error(fmt.Sprintf("ERROR: Returning ResultSet:UnmarshalBinary w/ Error: '%+v'", err.Error()))
		return err
	}
	return nil
}
func (obj *ResultSet) GetMetadata() tgdb.TGResultSetMetaData {
	return obj.MetaData
}
type ElementType int
const (
	ElementTypeInvalid ElementType = iota
	ElementTypeList
	ElementTypeAttr
	ElementTypeAttrValue
	ElementTypeAttrValueTransient
	ElementTypeEntity
	ElementTypeMap
)
func (elementType ElementType) String() string {
	var buffer bytes.Buffer
	if elementType&ElementTypeInvalid == ElementTypeInvalid {
		buffer.WriteString("ElementTypeInvalid")
	} else if elementType&ElementTypeList == ElementTypeList {
		buffer.WriteString("ElementTypeList")
	} else if elementType&ElementTypeAttr == ElementTypeAttr {
		buffer.WriteString("ElementTypeAttr")
	} else if elementType&ElementTypeAttrValue == ElementTypeAttrValue {
		buffer.WriteString("ElementTypeAttrValue")
	} else if elementType&ElementTypeAttrValueTransient == ElementTypeAttrValueTransient {
		buffer.WriteString("ElementTypeAttrValueTransient")
	} else if elementType&ElementTypeEntity == ElementTypeEntity {
		buffer.WriteString("ElementTypeEntity")
	} else if elementType&ElementTypeMap == ElementTypeMap {
		buffer.WriteString("ElementTypeMap")
	}
	if buffer.Len() == 0 {
		return ""
	}
	return buffer.String()
}
func FillCollection(entityStream tgdb.TGInputStream, gof tgdb.TGGraphObjectFactory, col []interface{}) ([]interface{}, tgdb.TGError) {
	eleType, err := entityStream.(*ProtocolDataInputStream).ReadByte()
	if err != nil {
		logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:FillCollection - unable to read eleType in the response stream w/ error: '%s'", err.Error()))
		errMsg := "GremlinResult:FillCollection - unable to read element type in the response stream"
		return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
	}
	if logger.IsDebug() {
		logger.Debug(fmt.Sprintf("Inside Returning GremlinResult:FillCollection extracted eleType: '%+v'", eleType))
	}
	if ElementType(eleType) == ElementTypeList {
		col, err := ConstructList(entityStream, gof, col)
		if err != nil {
			logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:FillCollection - unable to read eleType in the response stream w/ error: '%s'", err.Error()))
			errMsg := "GremlinResult:FillCollection - unable to read element type in the response stream"
			return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
		}
		return col, nil
	} else {
		logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:FillCollection - Invalid gremlin response collection type : %+v", ElementType(eleType)))
		errMsg := fmt.Sprintf("GremlinResult:FillCollection - Invalid gremlin response collection type : %+v", ElementType(eleType))
		return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, "")
	}
}
func ConstructList(entityStream tgdb.TGInputStream, gof tgdb.TGGraphObjectFactory, col []interface{}) ([]interface{}, tgdb.TGError) {
	if logger.IsDebug() {
		logger.Debug(fmt.Sprint("Entering GremlinResult:ConstructList"))
	}
	size, err := entityStream.(*ProtocolDataInputStream).ReadInt()
	if err != nil {
		logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructList - unable to read size in the response stream w/ error: '%s'", err.Error()))
		errMsg := "GremlinResult:ConstructList unable to read size in the response stream"
		return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
	}
	if logger.IsDebug() {
		logger.Debug(fmt.Sprintf("Inside Returning GremlinResult:FillCollection extracted size: '%+v'", size))
	}
	eleType, err := entityStream.(*ProtocolDataInputStream).ReadByte()
	if err != nil {
		logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructList - unable to read eleType in the response stream w/ error: '%s'", err.Error()))
		errMsg := "GremlinResult:ConstructList unable to read element type in the response stream"
		return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
	}
	if logger.IsDebug() {
		logger.Debug(fmt.Sprintf("Inside Returning GremlinResult:ConstructList extracted eleType: '%+v'", eleType))
	}
	var dummyNode tgdb.TGNode
	if ElementType(eleType) == ElementTypeAttr || ElementType(eleType) == ElementTypeAttrValue || ElementType(eleType) == ElementTypeAttrValueTransient {
		node1, err := gof.CreateNode()
		if err != nil {
			logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructList - unable to gof.CreateNode() for element type: '%+v'", ElementType(eleType)))
			errMsg := fmt.Sprintf("GremlinResult:ConstructList unable to create node for element type: '%+v'", ElementType(eleType))
			return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
		}
		dummyNode = node1
	}
	for i:=0; i<size; i++ {
		if ElementType(eleType) == ElementTypeEntity {
			entityType, err := entityStream.(*ProtocolDataInputStream).ReadByte()
			if err != nil {
				logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructList  - unable to read entityType in the response stream w/ error: '%s'", err.Error()))
				errMsg := "GremlinResult:ConstructList - unable to read entity type in the entity stream"
				return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
			}
			kindId := tgdb.TGEntityKind(entityType)
			switch kindId {
			case tgdb.EntityKindNode:
				node, nErr := gof.CreateNode()
				if nErr != nil {
					logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructList - unable to gof.CreateNode() for element type: '%+v'", ElementType(eleType)))
					errMsg := fmt.Sprintf("GremlinResult:ConstructList unable to create node for element type: '%+v'", ElementType(eleType))
					return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, nErr.Error())
				}
				err = node.ReadExternal(entityStream)
				if err != nil {
					logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructList  - unable to node.ReadExternal w/ error: '%s'", err.Error()))
					errMsg := "GremlinResult:ConstructList - unable to node.ReadExternal in the entity stream"
					return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
				}
				col = append(col, node)
			case tgdb.EntityKindEdge:
				edge, nErr := gof.CreateEntity(tgdb.EntityKindEdge)
				if nErr != nil {
					logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructList - unable to gof.CreateNode() for element type: '%+v'", ElementType(eleType)))
					errMsg := fmt.Sprintf("GremlinResult:ConstructList unable to create node for element type: '%+v'", ElementType(eleType))
					return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, nErr.Error())
				}
				err = edge.ReadExternal(entityStream)
				if err != nil {
					logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructList  - unable to edge.ReadExternal w/ error: '%s'", err.Error()))
					errMsg := "GremlinResult:ConstructList - unable to edge.ReadExternal in the entity stream"
					return nil, GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
				}
				col = append(col, edge)
			case tgdb.EntityKindGraph:
				fallthrough
			case tgdb.EntityKindInvalid:
				fallthrough
			default:
				logger.Error(fmt.Sprint("ERROR: Returning GremlinResult:ConstructList - Invalid entity kind from gremlin response stream"))
				break
			}
		} else if ElementType(eleType) == ElementTypeList {
			colElem := make([]interface{}, 0)
			colElem, _ = ConstructList(entityStream, gof, colElem)
			col = append(col, colElem)
		} else if ElementType(eleType) == ElementTypeMap {
			mapElem := make(map[string]interface{}, 0)
			_ = ConstructMap(entityStream, gof, mapElem)
			col = append(col, mapElem)
		} else if ElementType(eleType) == ElementTypeAttr || ElementType(eleType) == ElementTypeAttrValue || ElementType(eleType) == ElementTypeAttrValueTransient {
			attr, err := ReadExternalForEntity(dummyNode, entityStream)
			if err != nil {
				logger.Error(fmt.Sprintf("ERROR: Returning AbstractEntity:AbstractEntityReadExternal - unable to read attr w/ Error: '%+v'", err.Error()))
				return nil, err
			}
			if ElementType(eleType) == ElementTypeAttr {
				col = append(col, attr)
			} else {
				col = append(col, attr.GetValue())
			}
		} else {
			logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructList - Invalid element type '%+v' from Gremlin response stream", eleType))
		}
	}	 
	if logger.IsDebug() {
		logger.Debug(fmt.Sprint("Returning GremlinResult:ConstructList"))
	}
	return col, nil
}
func ConstructMap(entityStream tgdb.TGInputStream, gof tgdb.TGGraphObjectFactory, colMap map[string]interface{}) tgdb.TGError {
	if logger.IsDebug() {
		logger.Debug(fmt.Sprint("Entering GremlinResult:ConstructMap"))
	}
	size, err := entityStream.(*ProtocolDataInputStream).ReadInt()
	if err != nil {
		logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructMap - unable to read size in the response stream w/ error: '%s'", err.Error()))
		errMsg := "GremlinResult:ConstructMap unable to read size in the response stream"
		return GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
	}
	if logger.IsDebug() {
		logger.Debug(fmt.Sprintf("Inside Returning GremlinResult:FillCollection extracted size: '%+v'", size))
	}
	for i:=0; i<size; i++ {
		key, err := entityStream.(*ProtocolDataInputStream).ReadUTF()
		if err != nil {
			logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructMap  - unable to read key in the response stream w/ error: '%s'", err.Error()))
			errMsg := "GremlinResult:ConstructMap - unable to read key in the entity stream"
			return GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
		}
		if logger.IsDebug() {
			logger.Debug(fmt.Sprintf("Inside Returning GremlinResult:FillCollection extracted key: '%+v'", key))
		}
		eleType, err := entityStream.(*ProtocolDataInputStream).ReadByte()
		if err != nil {
			logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructMap - unable to read eleType in the response stream w/ error: '%s'", err.Error()))
			errMsg := "GremlinResult:ConstructMap unable to read element type in the response stream"
			return GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
		}
		if logger.IsDebug() {
			logger.Debug(fmt.Sprintf("Inside Returning GremlinResult:ConstructMap extracted eleType: '%+v'", eleType))
		}
		var dummyNode tgdb.TGNode
		if ElementType(eleType) == ElementTypeAttr || ElementType(eleType) == ElementTypeAttrValue || ElementType(eleType) == ElementTypeAttrValueTransient {
			node1, err := gof.CreateNode()
			if err != nil {
				logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructList - unable to gof.CreateNode() for element type: '%+v'", ElementType(eleType)))
				errMsg := fmt.Sprintf("GremlinResult:ConstructList unable to create node for element type: '%+v'", ElementType(eleType))
				return GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
			}
			dummyNode = node1
		}
		if ElementType(eleType) == ElementTypeEntity {
			entityType, err := entityStream.(*ProtocolDataInputStream).ReadByte()
			if err != nil {
				logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructMap  - unable to read entityType in the response stream w/ error: '%s'", err.Error()))
				errMsg := "GremlinResult:ConstructMap - unable to read entity type in the entity stream"
				return GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
			}
			kindId := tgdb.TGEntityKind(entityType)
			switch kindId {
			case tgdb.EntityKindNode:
				node, nErr := gof.CreateNode()
				if nErr != nil {
					logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructMap - unable to gof.CreateNode() for element type: '%+v'", ElementType(eleType)))
					errMsg := fmt.Sprintf("GremlinResult:ConstructMap unable to create node for element type: '%+v'", ElementType(eleType))
					return GetErrorByType(TGErrorGeneralException, "", errMsg, nErr.Error())
				}
				err = node.ReadExternal(entityStream)
				if err != nil {
					logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructMap  - unable to node.ReadExternal w/ error: '%s'", err.Error()))
					errMsg := "GremlinResult:ConstructMap - unable to node.ReadExternal in the entity stream"
					return GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
				}
				colMap[key] = node
			case tgdb.EntityKindEdge:
				edge, nErr := gof.CreateEntity(tgdb.EntityKindEdge)
				if nErr != nil {
					logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructMap - unable to gof.CreateNode() for element type: '%+v'", ElementType(eleType)))
					errMsg := fmt.Sprintf("GremlinResult:ConstructMap unable to create node for element type: '%+v'", ElementType(eleType))
					return GetErrorByType(TGErrorGeneralException, "", errMsg, nErr.Error())
				}
				err = edge.ReadExternal(entityStream)
				if err != nil {
					logger.Error(fmt.Sprintf("ERROR: Returning GremlinResult:ConstructMap  - unable to edge.ReadExternal w/ error: '%s'", err.Error()))
					errMsg := "GremlinResult:ConstructMap - unable to edge.ReadExternal in the entity stream"
					return GetErrorByType(TGErrorGeneralException, "", errMsg, err.Error())
				}
				colMap[key] = edge
			case tgdb.EntityKindGraph:
				fallthrough
			case tgdb.EntityKindInvalid:
				fallthrough
			default:
				logger.Error(fmt.Sprint("ERROR: Returning GremlinResult:ConstructList - Invalid entity kind from gremlin response stream"))
				break
			}
		} else if ElementType(eleType) == ElementTypeAttr || ElementType(eleType) == ElementTypeAttrValue || ElementType(eleType) == ElementTypeAttrValueTransient {
			attr, err := ReadExternalForEntity(dummyNode, entityStream)
			if err != nil {
				logger.Error(fmt.Sprintf("ERROR: Returning AbstractEntity:AbstractEntityReadExternal - unable to read attr w/ Error: '%+v'", err.Error()))
				return err
			}
			colMap[key] = attr
			if ElementType(eleType) == ElementTypeAttr {
				colMap[key] = attr
			} else {
				colMap[key] = attr.GetValue()
			}
		} else if ElementType(eleType) == ElementTypeList {
			colElem := make([]interface{}, 0)
			colElem, _ = ConstructList(entityStream, gof, colElem)
			colMap[key] = colElem
		} else if ElementType(eleType) == ElementTypeMap {
			mapElem := make(map[string]interface{}, 0)
			_ = ConstructMap(entityStream, gof, mapElem)
			colMap[key] = mapElem
		}
	}	 
	if logger.IsDebug() {
		logger.Debug(fmt.Sprint("Returning GremlinResult:ConstructMap"))
	}
	return nil
}
type TGQueryImpl struct {
	qryConnection tgdb.TGConnection
	qryHashId     int64
	qryOption     *TGQueryOptionImpl
	qryParameters map[string]interface{}
}
func DefaultQuery() *TGQueryImpl {
	gob.Register(TGQueryImpl{})
	newQuery := TGQueryImpl{
		qryHashId:     -1,
		qryParameters: make(map[string]interface{}, 0),
	}
	newQuery.qryOption = DefaultQueryOption()
	return &newQuery
}
var _ tgdb.TGQuery = (*TGQueryImpl)(nil)
func NewQuery(conn tgdb.TGConnection, queryHashId int64) *TGQueryImpl {
	newQuery := DefaultQuery()
	newQuery.qryConnection = conn
	newQuery.qryHashId = queryHashId
	return newQuery
}
func (obj *TGQueryImpl) GetQueryConnection() tgdb.TGConnection {
	return obj.qryConnection
}
func (obj *TGQueryImpl) GetQueryId() int64 {
	return obj.qryHashId
}
func (obj *TGQueryImpl) GetQueryOption() *TGQueryOptionImpl {
	return obj.qryOption
}
func (obj *TGQueryImpl) GetQueryParameters() map[string]interface{} {
	return obj.qryParameters
}
func (obj *TGQueryImpl) SetQueryId(qId int64) {
	obj.qryHashId = qId
}
func (obj *TGQueryImpl) SetQueryOption(queryOptions *TGQueryOptionImpl) {
	obj.qryOption = queryOptions
}
func (obj *TGQueryImpl) SetQueryParameters(params map[string]interface{}) {
	obj.qryParameters = params
}
func (obj *TGQueryImpl) setQueryParameter(name string, value interface{}) {
	obj.qryParameters[name] = value
}
func (obj *TGQueryImpl) Close() {
	_, _ = obj.qryConnection.CloseQuery(obj.qryHashId)
}
func (obj *TGQueryImpl) Execute() tgdb.TGResultSet {
	rSet, _ := obj.qryConnection.ExecuteQueryWithId(obj.qryHashId, obj.qryOption)
	return rSet
}
func (obj *TGQueryImpl) SetBoolean(name string, value bool) {
	obj.setQueryParameter(name, value)
}
func (obj *TGQueryImpl) SetBytes(name string, value []byte) {
	obj.setQueryParameter(name, value)
}
func (obj *TGQueryImpl) SetChar(name string, value string) {
	obj.setQueryParameter(name, value)
}
func (obj *TGQueryImpl) SetDate(name string, value time.Time) {
	obj.setQueryParameter(name, value)
}
func (obj *TGQueryImpl) SetDouble(name string, value float64) {
	obj.setQueryParameter(name, value)
}
func (obj *TGQueryImpl) SetFloat(name string, value float32) {
	obj.setQueryParameter(name, value)
}
func (obj *TGQueryImpl) SetInt(name string, value int) {
	obj.setQueryParameter(name, value)
}
func (obj *TGQueryImpl) SetLong(name string, value int64) {
	obj.setQueryParameter(name, value)
}
func (obj *TGQueryImpl) SetNull(name string) {
	obj.setQueryParameter(name, nil)
}
func (obj *TGQueryImpl) SetOption(options tgdb.TGQueryOption) {
	obj.qryOption = options.(*TGQueryOptionImpl)
}
func (obj *TGQueryImpl) SetShort(name string, value int16) {
	obj.setQueryParameter(name, value)
}
func (obj *TGQueryImpl) SetString(name string, value string) {
	obj.setQueryParameter(name, value)
}
func (obj *TGQueryImpl) String() string {
	var buffer bytes.Buffer
	buffer.WriteString("TGQueryImpl:{")
	buffer.WriteString(fmt.Sprintf("QryConnection: %+v", obj.qryConnection))
	buffer.WriteString(fmt.Sprintf(", QryHashId: %+v", obj.qryHashId))
	buffer.WriteString(fmt.Sprintf(", QryOption: %+v", obj.qryOption.String()))
	buffer.WriteString(fmt.Sprintf(", QryParameters: %+v", obj.qryParameters))
	buffer.WriteString("}")
	return buffer.String()
}
func (obj *TGQueryImpl) MarshalBinary() ([]byte, error) {
	var b bytes.Buffer
	_, err := fmt.Fprintln(&b, obj.qryConnection, obj.qryHashId, obj.qryOption, obj.qryParameters)
	if err != nil {
		logger.Error(fmt.Sprintf("ERROR: Returning TGQueryImpl:MarshalBinary w/ Error: '%+v'", err.Error()))
		return nil, err
	}
	return b.Bytes(), nil
}
func (obj *TGQueryImpl) UnmarshalBinary(data []byte) error {
	b := bytes.NewBuffer(data)
	_, err := fmt.Fscanln(b, &obj.qryConnection, &obj.qryHashId, &obj.qryOption, &obj.qryParameters)
	if err != nil {
		logger.Error(fmt.Sprintf("ERROR: Returning TGQueryImpl:UnmarshalBinary w/ Error: '%+v'", err.Error()))
		return err
	}
	return nil
}
const (
	DefaultPrefetchSize    = 1000
	DefaultTraversalDepth  = 3
	DefaultEdgeLimit       = 0  
	DefaultOptionSortLimit = 0
	DefaultBatchSize       = 50
	OptionQueryBatchSize      = "batchsize"
	OptionQueryFetchSize      = "fetchsize"
	OptionQueryTraversalDepth = "traversaldepth"
	OptionQueryEdgeLimit      = "edgelimit"
	OptionQuerySortAttr       = "sortattrname"
	OptionQuerySortOrder      = "sortorder"			 
	OptionQuerySortLimit      = "sortresultlimit"
)
type TGQueryOptionImpl struct {
	optionProperties *SortedProperties
	mutable          bool
}
func DefaultQueryOption() *TGQueryOptionImpl {
	gob.Register(TGQueryOptionImpl{})
	newQryOption := TGQueryOptionImpl{
		optionProperties: NewSortedProperties(),
		mutable:          false,
	}
	return &newQryOption
}
var _ tgdb.TGQueryOption = (*TGQueryOptionImpl)(nil)