func (h *hydrator) trash() {
	h.value()
}
Trashes current value
package bolt
import (
	"errors"
	"fmt"
	"github.com/neo4j/neo4j-go-driver/v4/neo4j/log"
	"time"
	"github.com/neo4j/neo4j-go-driver/v4/neo4j/db"
	"github.com/neo4j/neo4j-go-driver/v4/neo4j/dbtype"
	"github.com/neo4j/neo4j-go-driver/v4/neo4j/internal/packstream"
)
var hydrationInvalidState = errors.New("Hydration state error")
type ignored struct{}
type success struct {
	fields        []string
	tfirst        int64
	qid           int64
	bookmark      string
	connectionId  string
	server        string
	db            string
	hasMore       bool
	tlast         int64
	qtype         db.StatementType
	counters      map[string]int
	plan          *db.Plan
	profile       *db.ProfiledPlan
	notifications []db.Notification
	routingTable  *db.RoutingTable
	num                uint32
	configurationHints map[string]interface{}
}
func (s *success) String() string {
	str := fmt.Sprintf("%#v", s)
	if s.plan != nil {
		str += fmt.Sprintf(" \nplan: %#v", s.plan)
	}
	if s.profile != nil {
		str += fmt.Sprintf(" \nprofile: %#v", s.profile)
	}
	if s.routingTable != nil {
		str += fmt.Sprintf(" \nrouting table: %#v", s.routingTable)
	}
	return str
}
func (s *success) summary() *db.Summary {
	return &db.Summary{
		Bookmark:      s.bookmark,
		StmntType:     s.qtype,
		Counters:      s.counters,
		TLast:         s.tlast,
		Plan:          s.plan,
		ProfiledPlan:  s.profile,
		Notifications: s.notifications,
		Database:      s.db,
	}
}
func (s *success) isResetResponse() bool {
	return s.num == 0
}
type hydrator struct {
	unpacker      packstream.Unpacker
	unp           *packstream.Unpacker
	err           error
	cachedIgnored ignored
	cachedSuccess success
	boltLogger    log.BoltLogger
	logId         string
}
func (h *hydrator) setErr(err error) {
	if h.err != nil {
		h.err = err
	}
}
func (h *hydrator) getErr() error {
	if h.unp.Err != nil {
		return h.unp.Err
	}
	return h.err
}
func (h *hydrator) assertLength(expect, actual uint32) {
	if expect != actual {
		h.setErr(errors.New(fmt.Sprintf(
			"Invalid length of struct, expected %d but was %d", expect, actual)))
	}
}
func (h *hydrator) hydrate(buf []byte) (x interface{}, err error) {
	h.unp = &h.unpacker
	h.unp.Reset(buf)
	h.unp.Next()
	if h.unp.Curr != packstream.PackedStruct {
		return nil, errors.New(fmt.Sprintf("Expected struct"))
	}
	n := h.unp.Len()
	t := h.unp.StructTag()
	switch t {
	case msgSuccess:
		x = h.success(n)
	case msgIgnored:
		x = h.ignored(n)
	case msgFailure:
		x = h.failure(n)
	case msgRecord:
		x = h.record(n)
	default:
		return nil, errors.New(fmt.Sprintf("Unexpected tag at top level: %d", t))
	}
	err = h.getErr()
	return
}
func (h *hydrator) ignored(n uint32) *ignored {
	h.assertLength(0, n)
	if h.getErr() != nil {
		return nil
	}
	if h.boltLogger != nil {
		h.boltLogger.LogServerMessage(h.logId, "IGNORED")
	}
	return &h.cachedIgnored
}
func (h *hydrator) failure(n uint32) *db.Neo4jError {
	h.assertLength(1, n)
	if h.getErr() != nil {
		return nil
	}
	dberr := db.Neo4jError{}
	h.unp.Next()  
	for maplen := h.unp.Len(); maplen > 0; maplen-- {
		h.unp.Next()
		key := h.unp.String()
		h.unp.Next()
		switch key {
		case "code":
			dberr.Code = h.unp.String()
		case "message":
			dberr.Msg = h.unp.String()
		default:
			h.trash()
		}
	}
	if h.boltLogger != nil {
		h.boltLogger.LogServerMessage(h.logId, "FAILURE %s", loggableFailure(dberr))
	}
	return &dberr
}
func (h *hydrator) success(n uint32) *success {
	h.assertLength(1, n)
	if h.getErr() != nil {
		return nil
	}
	h.cachedSuccess = success{}
	h.cachedSuccess.qid = -1
	succ := &h.cachedSuccess
	h.unp.Next()  
	n = h.unp.Len()
	succ.num = n
	for ; n > 0; n-- {
		h.unp.Next()
		key := h.unp.String()
		h.unp.Next()
		switch key {
		case "fields":
			succ.fields = h.strings()
		case "t_first":
			succ.tfirst = h.unp.Int()
		case "qid":
			succ.qid = h.unp.Int()
		case "bookmark":
			succ.bookmark = h.unp.String()
		case "connection_id":
			succ.connectionId = h.unp.String()
		case "server":
			succ.server = h.unp.String()
		case "has_more":
			succ.hasMore = h.unp.Bool()
		case "t_last":
			succ.tlast = h.unp.Int()
		case "type":
			switch h.unp.String() {
			case "r":
				succ.qtype = db.StatementTypeRead
			case "w":
				succ.qtype = db.StatementTypeWrite
			case "rw":
				succ.qtype = db.StatementTypeReadWrite
			case "s":
				succ.qtype = db.StatementTypeSchemaWrite
			}
		case "db":
			succ.db = h.unp.String()
		case "stats":
			succ.counters = h.successStats()
		case "plan":
			m := h.amap()
			succ.plan = parsePlan(m)
		case "profile":
			m := h.amap()
			succ.profile = parseProfile(m)
		case "notifications":
			l := h.array()
			succ.notifications = parseNotifications(l)
		case "rt":
			succ.routingTable = h.routingTable()
		case "hints":
			hints := h.amap()
			succ.configurationHints = hints
		default:
			h.trash()
		}
	}
	if h.boltLogger != nil {
		h.boltLogger.LogServerMessage(h.logId, "SUCCESS %s", loggableSuccess(*succ))
	}
	return succ
}
func (h *hydrator) successStats() map[string]int {
	n := h.unp.Len()
	if n == 0 {
		return nil
	}
	counts := make(map[string]int, n)
	for ; n > 0; n-- {
		h.unp.Next()
		key := h.unp.String()
		h.unp.Next()
		val := h.unp.Int()
		counts[key] = int(val)
	}
	return counts
}
func (h *hydrator) routingTable() *db.RoutingTable {
	rt := db.RoutingTable{}
	nkeys := h.unp.Len()
	for ; nkeys > 0; nkeys-- {
		h.unp.Next()
		key := h.unp.String()
		h.unp.Next()
		switch key {
		case "ttl":
			rt.TimeToLive = int(h.unp.Int())
		case "servers":
			nservers := h.unp.Len()
			for ; nservers > 0; nservers-- {
				h.routingTableRole(&rt)
			}
		default:
			h.trash()
		}
	}
	return &rt
}
func (h *hydrator) routingTableRole(rt *db.RoutingTable) {
	h.unp.Next()
	nkeys := h.unp.Len()
	var role string
	var addresses []string
	for ; nkeys > 0; nkeys-- {
		h.unp.Next()
		key := h.unp.String()
		h.unp.Next()
		switch key {
		case "role":
			role = h.unp.String()
		case "addresses":
			addresses = h.strings()
		default:
			h.trash()
		}
	}
	switch role {
	case "READ":
		rt.Readers = addresses
	case "WRITE":
		rt.Writers = addresses
	case "ROUTE":
		rt.Routers = addresses
	}
}
func (h *hydrator) strings() []string {
	n := h.unp.Len()
	slice := make([]string, n)
	for i := range slice {
		h.unp.Next()
		slice[i] = h.unp.String()
	}
	return slice
}
func (h *hydrator) amap() map[string]interface{} {
	n := h.unp.Len()
	m := make(map[string]interface{}, n)
	for ; n > 0; n-- {
		h.unp.Next()
		key := h.unp.String()
		h.unp.Next()
		m[key] = h.value()
	}
	return m
}
func (h *hydrator) array() []interface{} {
	n := h.unp.Len()
	a := make([]interface{}, n)
	for i := range a {
		h.unp.Next()
		a[i] = h.value()
	}
	return a
}
func (h *hydrator) record(n uint32) *db.Record {
	h.assertLength(1, n)
	if h.getErr() != nil {
		return nil
	}
	rec := db.Record{}
	h.unp.Next()  
	n = h.unp.Len()
	rec.Values = make([]interface{}, n)
	for i := range rec.Values {
		h.unp.Next()
		rec.Values[i] = h.value()
	}
	if h.boltLogger != nil {
		h.boltLogger.LogServerMessage(h.logId, "RECORD %s", loggableList(rec.Values))
	}
	return &rec
}
func (h *hydrator) value() interface{} {
	switch h.unp.Curr {
	case packstream.PackedInt:
		return h.unp.Int()
	case packstream.PackedFloat:
		return h.unp.Float()
	case packstream.PackedStr:
		return h.unp.String()
	case packstream.PackedStruct:
		t := h.unp.StructTag()
		n := h.unp.Len()
		switch t {
		case 'N':
			return h.node(n)
		case 'R':
			return h.relationship(n)
		case 'r':
			return h.relationnode(n)
		case 'P':
			return h.path(n)
		case 'X':
			return h.point2d(n)
		case 'Y':
			return h.point3d(n)
		case 'F':
			return h.dateTimeOffset(n)
		case 'f':
			return h.dateTimeNamedZone(n)
		case 'd':
			return h.localDateTime(n)
		case 'D':
			return h.date(n)
		case 'T':
			return h.time(n)
		case 't':
			return h.localTime(n)
		case 'E':
			return h.duration(n)
		default:
			h.err = errors.New(fmt.Sprintf("Unknown tag: %02x", t))
			return nil
		}
	case packstream.PackedByteArray:
		return h.unp.ByteArray()
	case packstream.PackedArray:
		return h.array()
	case packstream.PackedMap:
		return h.amap()
	case packstream.PackedNil:
		return nil
	case packstream.PackedTrue:
		return true
	case packstream.PackedFalse:
		return false
	default:
		h.setErr(hydrationInvalidState)
		return nil
	}
}