package pgtype

import (
	
	
	
	
	
	
	
	
)
PostgreSQL oids for common types
const (
	BoolOID             = 16
	ByteaOID            = 17
	QCharOID            = 18
	NameOID             = 19
	Int8OID             = 20
	Int2OID             = 21
	Int4OID             = 23
	TextOID             = 25
	OIDOID              = 26
	TIDOID              = 27
	XIDOID              = 28
	CIDOID              = 29
	JSONOID             = 114
	PointOID            = 600
	LsegOID             = 601
	PathOID             = 602
	BoxOID              = 603
	PolygonOID          = 604
	LineOID             = 628
	CIDROID             = 650
	CIDRArrayOID        = 651
	Float4OID           = 700
	Float8OID           = 701
	CircleOID           = 718
	UnknownOID          = 705
	MacaddrOID          = 829
	InetOID             = 869
	BoolArrayOID        = 1000
	Int2ArrayOID        = 1005
	Int4ArrayOID        = 1007
	TextArrayOID        = 1009
	ByteaArrayOID       = 1001
	BPCharArrayOID      = 1014
	VarcharArrayOID     = 1015
	Int8ArrayOID        = 1016
	Float4ArrayOID      = 1021
	Float8ArrayOID      = 1022
	ACLItemOID          = 1033
	ACLItemArrayOID     = 1034
	InetArrayOID        = 1041
	BPCharOID           = 1042
	VarcharOID          = 1043
	DateOID             = 1082
	TimeOID             = 1083
	TimestampOID        = 1114
	TimestampArrayOID   = 1115
	DateArrayOID        = 1182
	TimestamptzOID      = 1184
	TimestamptzArrayOID = 1185
	IntervalOID         = 1186
	NumericArrayOID     = 1231
	BitOID              = 1560
	VarbitOID           = 1562
	NumericOID          = 1700
	RecordOID           = 2249
	UUIDOID             = 2950
	UUIDArrayOID        = 2951
	JSONBOID            = 3802
	JSONBArrayOID       = 3807
	DaterangeOID        = 3912
	Int4rangeOID        = 3904
	NumrangeOID         = 3906
	TsrangeOID          = 3908
	TsrangeArrayOID     = 3909
	TstzrangeOID        = 3910
	TstzrangeArrayOID   = 3911
	Int8rangeOID        = 3926
)

type Status byte

const (
	Undefined Status = iota
	Null
	Present
)

type InfinityModifier int8

const (
	Infinity         InfinityModifier = 1
	None             InfinityModifier = 0
	NegativeInfinity InfinityModifier = -Infinity
)

func ( InfinityModifier) () string {
	switch  {
	case None:
		return "none"
	case Infinity:
		return "infinity"
	case NegativeInfinity:
		return "-infinity"
	default:
		return "invalid"
	}
}
PostgreSQL format codes
const (
	TextFormatCode   = 0
	BinaryFormatCode = 1
)
Value translates values to and from an internal canonical representation for the type. To actually be usable a type that implements Value should also implement some combination of BinaryDecoder, BinaryEncoder, TextDecoder, and TextEncoder. Operations that update a Value (e.g. Set, DecodeText, DecodeBinary) should entirely replace the value. e.g. Internal slices should be replaced not resized and reused. This allows Get and AssignTo to return a slice directly rather than incur a usually unnecessary copy.
Set converts and assigns src to itself. Value takes ownership of src.
	Set(src interface{}) error
Get returns the simplest representation of Value. Get may return a pointer to an internal value but it must never mutate that value. e.g. If Get returns a []byte Value must never change the contents of the []byte.
	Get() interface{}
AssignTo converts and assigns the Value to dst. AssignTo may a pointer to an internal value but it must never mutate that value. e.g. If Get returns a []byte Value must never change the contents of the []byte.
	AssignTo(dst interface{}) error
}
TypeValue is a Value where instances can represent different PostgreSQL types. This can be useful for representing types such as enums, composites, and arrays. In general, instances of TypeValue should not be used to directly represent a value. It should only be used as an encoder and decoder internal to ConnInfo.
type TypeValue interface {
	Value
NewTypeValue creates a TypeValue including references to internal type information. e.g. the list of members in an EnumType.
	NewTypeValue() Value
TypeName returns the PostgreSQL name of this type.
	TypeName() string
}
ValueTranscoder is a value that implements the text and binary encoding and decoding interfaces.
ResultFormatPreferrer allows a type to specify its preferred result format instead of it being inferred from whether it is also a BinaryDecoder.
type ResultFormatPreferrer interface {
	PreferredResultFormat() int16
}
ParamFormatPreferrer allows a type to specify its preferred param format instead of it being inferred from whether it is also a BinaryEncoder.
type ParamFormatPreferrer interface {
	PreferredParamFormat() int16
}

DecodeBinary decodes src into BinaryDecoder. If src is nil then the original SQL value is NULL. BinaryDecoder takes ownership of src. The caller MUST not use it again.
	DecodeBinary(ci *ConnInfo, src []byte) error
}

DecodeText decodes src into TextDecoder. If src is nil then the original SQL value is NULL. TextDecoder takes ownership of src. The caller MUST not use it again.
	DecodeText(ci *ConnInfo, src []byte) error
}
BinaryEncoder is implemented by types that can encode themselves into the PostgreSQL binary wire format.
EncodeBinary should append the binary format of self to buf. If self is the SQL value NULL then append nothing and return (nil, nil). The caller of EncodeBinary is responsible for writing the correct NULL value or the length of the data written.
	EncodeBinary(ci *ConnInfo, buf []byte) (newBuf []byte, err error)
}
TextEncoder is implemented by types that can encode themselves into the PostgreSQL text wire format.
EncodeText should append the text format of self to buf. If self is the SQL value NULL then append nothing and return (nil, nil). The caller of EncodeText is responsible for writing the correct NULL value or the length of the data written.
	EncodeText(ci *ConnInfo, buf []byte) (newBuf []byte, err error)
}

var errUndefined = errors.New("cannot encode status undefined")
var errBadStatus = errors.New("invalid status")

type nullAssignmentError struct {
	dst interface{}
}

func ( *nullAssignmentError) () string {
	return fmt.Sprintf("cannot assign NULL to %T", .dst)
}

type DataType struct {
	Value Value

	textDecoder   TextDecoder
	binaryDecoder BinaryDecoder

	Name string
	OID  uint32
}

type ConnInfo struct {
	oidToDataType         map[uint32]*DataType
	nameToDataType        map[string]*DataType
	reflectTypeToName     map[reflect.Type]string
	oidToParamFormatCode  map[uint32]int16
	oidToResultFormatCode map[uint32]int16

	reflectTypeToDataType map[reflect.Type]*DataType
}

func () *ConnInfo {
	return &ConnInfo{
		oidToDataType:         make(map[uint32]*DataType),
		nameToDataType:        make(map[string]*DataType),
		reflectTypeToName:     make(map[reflect.Type]string),
		oidToParamFormatCode:  make(map[uint32]int16),
		oidToResultFormatCode: make(map[uint32]int16),
	}
}

func () *ConnInfo {
	 := newConnInfo()

	.RegisterDataType(DataType{Value: &ACLItemArray{}, Name: "_aclitem", OID: ACLItemArrayOID})
	.RegisterDataType(DataType{Value: &BoolArray{}, Name: "_bool", OID: BoolArrayOID})
	.RegisterDataType(DataType{Value: &BPCharArray{}, Name: "_bpchar", OID: BPCharArrayOID})
	.RegisterDataType(DataType{Value: &ByteaArray{}, Name: "_bytea", OID: ByteaArrayOID})
	.RegisterDataType(DataType{Value: &CIDRArray{}, Name: "_cidr", OID: CIDRArrayOID})
	.RegisterDataType(DataType{Value: &DateArray{}, Name: "_date", OID: DateArrayOID})
	.RegisterDataType(DataType{Value: &Float4Array{}, Name: "_float4", OID: Float4ArrayOID})
	.RegisterDataType(DataType{Value: &Float8Array{}, Name: "_float8", OID: Float8ArrayOID})
	.RegisterDataType(DataType{Value: &InetArray{}, Name: "_inet", OID: InetArrayOID})
	.RegisterDataType(DataType{Value: &Int2Array{}, Name: "_int2", OID: Int2ArrayOID})
	.RegisterDataType(DataType{Value: &Int4Array{}, Name: "_int4", OID: Int4ArrayOID})
	.RegisterDataType(DataType{Value: &Int8Array{}, Name: "_int8", OID: Int8ArrayOID})
	.RegisterDataType(DataType{Value: &NumericArray{}, Name: "_numeric", OID: NumericArrayOID})
	.RegisterDataType(DataType{Value: &TextArray{}, Name: "_text", OID: TextArrayOID})
	.RegisterDataType(DataType{Value: &TimestampArray{}, Name: "_timestamp", OID: TimestampArrayOID})
	.RegisterDataType(DataType{Value: &TimestamptzArray{}, Name: "_timestamptz", OID: TimestamptzArrayOID})
	.RegisterDataType(DataType{Value: &UUIDArray{}, Name: "_uuid", OID: UUIDArrayOID})
	.RegisterDataType(DataType{Value: &VarcharArray{}, Name: "_varchar", OID: VarcharArrayOID})
	.RegisterDataType(DataType{Value: &ACLItem{}, Name: "aclitem", OID: ACLItemOID})
	.RegisterDataType(DataType{Value: &Bit{}, Name: "bit", OID: BitOID})
	.RegisterDataType(DataType{Value: &Bool{}, Name: "bool", OID: BoolOID})
	.RegisterDataType(DataType{Value: &Box{}, Name: "box", OID: BoxOID})
	.RegisterDataType(DataType{Value: &BPChar{}, Name: "bpchar", OID: BPCharOID})
	.RegisterDataType(DataType{Value: &Bytea{}, Name: "bytea", OID: ByteaOID})
	.RegisterDataType(DataType{Value: &QChar{}, Name: "char", OID: QCharOID})
	.RegisterDataType(DataType{Value: &CID{}, Name: "cid", OID: CIDOID})
	.RegisterDataType(DataType{Value: &CIDR{}, Name: "cidr", OID: CIDROID})
	.RegisterDataType(DataType{Value: &Circle{}, Name: "circle", OID: CircleOID})
	.RegisterDataType(DataType{Value: &Date{}, Name: "date", OID: DateOID})
	.RegisterDataType(DataType{Value: &Daterange{}, Name: "daterange", OID: DaterangeOID})
	.RegisterDataType(DataType{Value: &Float4{}, Name: "float4", OID: Float4OID})
	.RegisterDataType(DataType{Value: &Float8{}, Name: "float8", OID: Float8OID})
	.RegisterDataType(DataType{Value: &Inet{}, Name: "inet", OID: InetOID})
	.RegisterDataType(DataType{Value: &Int2{}, Name: "int2", OID: Int2OID})
	.RegisterDataType(DataType{Value: &Int4{}, Name: "int4", OID: Int4OID})
	.RegisterDataType(DataType{Value: &Int4range{}, Name: "int4range", OID: Int4rangeOID})
	.RegisterDataType(DataType{Value: &Int8{}, Name: "int8", OID: Int8OID})
	.RegisterDataType(DataType{Value: &Int8range{}, Name: "int8range", OID: Int8rangeOID})
	.RegisterDataType(DataType{Value: &Interval{}, Name: "interval", OID: IntervalOID})
	.RegisterDataType(DataType{Value: &JSON{}, Name: "json", OID: JSONOID})
	.RegisterDataType(DataType{Value: &JSONB{}, Name: "jsonb", OID: JSONBOID})
	.RegisterDataType(DataType{Value: &Line{}, Name: "line", OID: LineOID})
	.RegisterDataType(DataType{Value: &Lseg{}, Name: "lseg", OID: LsegOID})
	.RegisterDataType(DataType{Value: &Macaddr{}, Name: "macaddr", OID: MacaddrOID})
	.RegisterDataType(DataType{Value: &Name{}, Name: "name", OID: NameOID})
	.RegisterDataType(DataType{Value: &Numeric{}, Name: "numeric", OID: NumericOID})
	.RegisterDataType(DataType{Value: &Numrange{}, Name: "numrange", OID: NumrangeOID})
	.RegisterDataType(DataType{Value: &OIDValue{}, Name: "oid", OID: OIDOID})
	.RegisterDataType(DataType{Value: &Path{}, Name: "path", OID: PathOID})
	.RegisterDataType(DataType{Value: &Point{}, Name: "point", OID: PointOID})
	.RegisterDataType(DataType{Value: &Polygon{}, Name: "polygon", OID: PolygonOID})
	.RegisterDataType(DataType{Value: &Record{}, Name: "record", OID: RecordOID})
	.RegisterDataType(DataType{Value: &Text{}, Name: "text", OID: TextOID})
	.RegisterDataType(DataType{Value: &TID{}, Name: "tid", OID: TIDOID})
	.RegisterDataType(DataType{Value: &Time{}, Name: "time", OID: TimeOID})
	.RegisterDataType(DataType{Value: &Timestamp{}, Name: "timestamp", OID: TimestampOID})
	.RegisterDataType(DataType{Value: &Timestamptz{}, Name: "timestamptz", OID: TimestamptzOID})
	.RegisterDataType(DataType{Value: &Tsrange{}, Name: "tsrange", OID: TsrangeOID})
	.RegisterDataType(DataType{Value: &TsrangeArray{}, Name: "_tsrange", OID: TsrangeArrayOID})
	.RegisterDataType(DataType{Value: &Tstzrange{}, Name: "tstzrange", OID: TstzrangeOID})
	.RegisterDataType(DataType{Value: &TstzrangeArray{}, Name: "_tstzrange", OID: TstzrangeArrayOID})
	.RegisterDataType(DataType{Value: &Unknown{}, Name: "unknown", OID: UnknownOID})
	.RegisterDataType(DataType{Value: &UUID{}, Name: "uuid", OID: UUIDOID})
	.RegisterDataType(DataType{Value: &Varbit{}, Name: "varbit", OID: VarbitOID})
	.RegisterDataType(DataType{Value: &Varchar{}, Name: "varchar", OID: VarcharOID})
	.RegisterDataType(DataType{Value: &XID{}, Name: "xid", OID: XIDOID})

	 := func(,  string,  interface{}) {
		.RegisterDefaultPgType(, )
		 := reflect.TypeOf()

		.RegisterDefaultPgType(reflect.New().Interface(), )

		 := reflect.SliceOf()
		.RegisterDefaultPgType(reflect.MakeSlice(, 0, 0).Interface(), )

		.RegisterDefaultPgType(reflect.New().Interface(), )
	}
Integer types that directly map to a PostgreSQL type
	("int2", "_int2", int16(0))
	("int4", "_int4", int32(0))
	("int8", "_int8", int64(0))
Integer types that do not have a direct match to a PostgreSQL type
	("int8", "_int8", uint16(0))
	("int8", "_int8", uint32(0))
	("int8", "_int8", uint64(0))
	("int8", "_int8", int(0))
	("int8", "_int8", uint(0))

	("float4", "_float4", float32(0))
	("float8", "_float8", float64(0))

	("bool", "_bool", false)
	("timestamptz", "_timestamptz", time.Time{})
	("text", "_text", "")
	("bytea", "_bytea", []byte(nil))

	("inet", "_inet", net.IP{})
	.RegisterDefaultPgType((*net.IPNet)(nil), "cidr")
	.RegisterDefaultPgType([]*net.IPNet(nil), "_cidr")

	return 
}

func ( *ConnInfo) ( map[string]uint32) {
	for ,  := range  {
		var  Value
		if ,  := nameValues[];  {
			 = reflect.New(reflect.ValueOf().Elem().Type()).Interface().(Value)
		} else {
			 = &GenericText{}
		}
		.RegisterDataType(DataType{Value: , Name: , OID: })
	}
}

func ( *ConnInfo) ( DataType) {
	.Value = NewValue(.Value)

	.oidToDataType[.OID] = &
	.nameToDataType[.Name] = &

	{
		var  int16
		if ,  := .Value.(ParamFormatPreferrer);  {
			 = .PreferredParamFormat()
		} else if ,  := .Value.(BinaryEncoder);  {
			 = BinaryFormatCode
		}
		.oidToParamFormatCode[.OID] = 
	}

	{
		var  int16
		if ,  := .Value.(ResultFormatPreferrer);  {
			 = .PreferredResultFormat()
		} else if ,  := .Value.(BinaryDecoder);  {
			 = BinaryFormatCode
		}
		.oidToResultFormatCode[.OID] = 
	}

	if ,  := .Value.(TextDecoder);  {
		.textDecoder = 
	}

	if ,  := .Value.(BinaryDecoder);  {
		.binaryDecoder = 
	}

	.reflectTypeToDataType = nil // Invalidated by type registration
}
RegisterDefaultPgType registers a mapping of a Go type to a PostgreSQL type name. Typically the data type to be encoded or decoded is determined by the PostgreSQL OID. But if the OID of a value to be encoded or decoded is unknown, this additional mapping will be used by DataTypeForValue to determine a suitable data type.
func ( *ConnInfo) ( interface{},  string) {
	.reflectTypeToName[reflect.TypeOf()] = 
	.reflectTypeToDataType = nil // Invalidated by registering a default type
}

func ( *ConnInfo) ( uint32) (*DataType, bool) {
	,  := .oidToDataType[]
	return , 
}

func ( *ConnInfo) ( string) (*DataType, bool) {
	,  := .nameToDataType[]
	return , 
}

func ( *ConnInfo) () {
	.reflectTypeToDataType = make(map[reflect.Type]*DataType)

	for ,  := range .oidToDataType {
		if ,  := .Value.(TypeValue); ! {
			.reflectTypeToDataType[reflect.ValueOf(.Value).Type()] = 
		}
	}

	for ,  := range .reflectTypeToName {
		if ,  := .nameToDataType[];  {
			.reflectTypeToDataType[] = 
		}
	}
}
DataTypeForValue finds a data type suitable for v. Use RegisterDataType to register types that can encode and decode themselves. Use RegisterDefaultPgType to register that can be handled by a registered data type.
func ( *ConnInfo) ( interface{}) (*DataType, bool) {
	if .reflectTypeToDataType == nil {
		.buildReflectTypeToDataType()
	}

	if ,  := .(TypeValue);  {
		,  := .nameToDataType[.TypeName()]
		return , 
	}

	,  := .reflectTypeToDataType[reflect.TypeOf()]
	return , 
}

func ( *ConnInfo) ( uint32) int16 {
	,  := .oidToParamFormatCode[]
	if  {
		return 
	}
	return TextFormatCode
}

func ( *ConnInfo) ( uint32) int16 {
	,  := .oidToResultFormatCode[]
	if  {
		return 
	}
	return TextFormatCode
}
DeepCopy makes a deep copy of the ConnInfo.
func ( *ConnInfo) () *ConnInfo {
	 := newConnInfo()

	for ,  := range .oidToDataType {
		.RegisterDataType(DataType{
			Value: NewValue(.Value),
			Name:  .Name,
			OID:   .OID,
		})
	}

	for ,  := range .reflectTypeToName {
		.reflectTypeToName[] = 
	}

	return 
}
ScanPlan is a precompiled plan to scan into a type of destination.
Scan scans src into dst. If the dst type has changed in an incompatible way a ScanPlan should automatically replan and scan.
	Scan(ci *ConnInfo, oid uint32, formatCode int16, src []byte, dst interface{}) error
}

type scanPlanDstBinaryDecoder struct{}

func (scanPlanDstBinaryDecoder) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	if ,  := ().(BinaryDecoder);  {
		return .DecodeBinary(, )
	}

	 := .PlanScan(, , )
	return .Scan(, , , , )
}

type scanPlanDstTextDecoder struct{}

func ( scanPlanDstTextDecoder) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	if ,  := ().(TextDecoder);  {
		return .DecodeText(, )
	}

	 := .PlanScan(, , )
	return .Scan(, , , , )
}

type scanPlanDataTypeSQLScanner DataType

func ( *scanPlanDataTypeSQLScanner) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	,  := .(sql.Scanner)
	if ! {
		 := .PlanScan(, , )
		return .Scan(, , , , )
	}

	 := (*DataType)()
	var  error
	switch  {
	case BinaryFormatCode:
		 = .binaryDecoder.DecodeBinary(, )
	case TextFormatCode:
		 = .textDecoder.DecodeText(, )
	}
	if  != nil {
		return 
	}

	,  := DatabaseSQLValue(, .Value)
	if  != nil {
		return 
	}
	return .Scan()
}

type scanPlanDataTypeAssignTo DataType

func ( *scanPlanDataTypeAssignTo) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	 := (*DataType)()
	var  error
	switch  {
	case BinaryFormatCode:
		 = .binaryDecoder.DecodeBinary(, )
	case TextFormatCode:
		 = .textDecoder.DecodeText(, )
	}
	if  != nil {
		return 
	}

	 := .Value.AssignTo()
	if  == nil {
		return nil
	}

	if ,  := .(*interface{});  {
		* = .Value.Get()
		return nil
	}
assignToErr might have failed because the type of destination has changed
	 := .PlanScan(, , )
	if ,  := .(*scanPlanDataTypeAssignTo); ! {
		return .(, , , , )
	}

	return 
}

type scanPlanSQLScanner struct{}

func (scanPlanSQLScanner) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	 := .(sql.Scanner)
	if  == BinaryFormatCode {
		return .Scan()
	} else {
		return .Scan(string())
	}
}

type scanPlanReflection struct{}

We might be given a pointer to something that implements the decoder interface(s), even though the pointer itself doesn't.
	 := reflect.ValueOf()
If the database returned NULL, then we set dest as nil to indicate that.
		if  == nil {
			 := reflect.Zero(.Type().Elem())
			.Elem().Set()
			return nil
		}
We need to allocate an element, and set the destination to it Then we can retry as that element.
		 := reflect.New(.Type().Elem().Elem())
		.Elem().Set()

		 := .PlanScan(, , .Interface())
		return .Scan(, , , , .Interface())
	}

	return scanUnknownType(, , , )
}

type scanPlanBinaryInt16 struct{}

func (scanPlanBinaryInt16) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	if  == nil {
		return fmt.Errorf("cannot scan null into %T", )
	}

	if len() != 2 {
		return fmt.Errorf("invalid length for int2: %v", len())
	}

	if ,  := ().(*int16);  {
		* = int16(binary.BigEndian.Uint16())
		return nil
	}

	 := .PlanScan(, , )
	return .Scan(, , , , )
}

type scanPlanBinaryInt32 struct{}

func (scanPlanBinaryInt32) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	if  == nil {
		return fmt.Errorf("cannot scan null into %T", )
	}

	if len() != 4 {
		return fmt.Errorf("invalid length for int4: %v", len())
	}

	if ,  := ().(*int32);  {
		* = int32(binary.BigEndian.Uint32())
		return nil
	}

	 := .PlanScan(, , )
	return .Scan(, , , , )
}

type scanPlanBinaryInt64 struct{}

func (scanPlanBinaryInt64) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	if  == nil {
		return fmt.Errorf("cannot scan null into %T", )
	}

	if len() != 8 {
		return fmt.Errorf("invalid length for int8: %v", len())
	}

	if ,  := ().(*int64);  {
		* = int64(binary.BigEndian.Uint64())
		return nil
	}

	 := .PlanScan(, , )
	return .Scan(, , , , )
}

type scanPlanBinaryFloat32 struct{}

func (scanPlanBinaryFloat32) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	if  == nil {
		return fmt.Errorf("cannot scan null into %T", )
	}

	if len() != 4 {
		return fmt.Errorf("invalid length for int4: %v", len())
	}

	if ,  := ().(*float32);  {
		 := int32(binary.BigEndian.Uint32())
		* = float32(math.Float32frombits(uint32()))
		return nil
	}

	 := .PlanScan(, , )
	return .Scan(, , , , )
}

type scanPlanBinaryFloat64 struct{}

func (scanPlanBinaryFloat64) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	if  == nil {
		return fmt.Errorf("cannot scan null into %T", )
	}

	if len() != 8 {
		return fmt.Errorf("invalid length for int8: %v", len())
	}

	if ,  := ().(*float64);  {
		 := int64(binary.BigEndian.Uint64())
		* = float64(math.Float64frombits(uint64()))
		return nil
	}

	 := .PlanScan(, , )
	return .Scan(, , , , )
}

type scanPlanBinaryBytes struct{}

func (scanPlanBinaryBytes) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	if ,  := ().(*[]byte);  {
		* = 
		return nil
	}

	 := .PlanScan(, , )
	return .Scan(, , , , )
}

type scanPlanString struct{}

func (scanPlanString) ( *ConnInfo,  uint32,  int16,  []byte,  interface{}) error {
	if  == nil {
		return fmt.Errorf("cannot scan null into %T", )
	}

	if ,  := ().(*string);  {
		* = string()
		return nil
	}

	 := .PlanScan(, , )
	return .Scan(, , , , )
}
PlanScan prepares a plan to scan a value into dst.
func ( *ConnInfo) ( uint32,  int16,  interface{}) ScanPlan {
	switch  {
	case BinaryFormatCode:
		switch .(type) {
		case *string:
			switch  {
			case TextOID, VarcharOID:
				return scanPlanString{}
			}
		case *int16:
			if  == Int2OID {
				return scanPlanBinaryInt16{}
			}
		case *int32:
			if  == Int4OID {
				return scanPlanBinaryInt32{}
			}
		case *int64:
			if  == Int8OID {
				return scanPlanBinaryInt64{}
			}
		case *float32:
			if  == Float4OID {
				return scanPlanBinaryFloat32{}
			}
		case *float64:
			if  == Float8OID {
				return scanPlanBinaryFloat64{}
			}
		case *[]byte:
			switch  {
			case ByteaOID, TextOID, VarcharOID, JSONOID:
				return scanPlanBinaryBytes{}
			}
		case BinaryDecoder:
			return scanPlanDstBinaryDecoder{}
		}
	case TextFormatCode:
		switch .(type) {
		case *string:
			return scanPlanString{}
		case *[]byte:
			if  != ByteaOID {
				return scanPlanBinaryBytes{}
			}
		case TextDecoder:
			return scanPlanDstTextDecoder{}
		}
	}

	var  *DataType

	if  == 0 {
		if ,  := .DataTypeForValue();  {
			 = 
		}
	} else {
		if ,  := .DataTypeForOID();  {
			 = 
		}
	}

	if  != nil {
		if ,  := .(sql.Scanner);  {
			return (*scanPlanDataTypeSQLScanner)()
		}
		return (*scanPlanDataTypeAssignTo)()
	}

	if ,  := .(sql.Scanner);  {
		return scanPlanSQLScanner{}
	}

	return scanPlanReflection{}
}

func ( *ConnInfo) ( uint32,  int16,  []byte,  interface{}) error {
	if  == nil {
		return nil
	}

	 := .PlanScan(, , )
	return .Scan(, , , , )
}

func ( uint32,  int16,  []byte,  interface{}) error {
	switch dest := .(type) {
	case *string:
		if  == BinaryFormatCode {
			return fmt.Errorf("unknown oid %d in binary format cannot be scanned into %T", , )
		}
		* = string()
		return nil
	case *[]byte:
		* = 
		return nil
	default:
		if ,  := GetAssignToDstType();  {
			return (, , , )
		}
		return fmt.Errorf("unknown oid %d cannot be scanned into %T", , )
	}
}
NewValue returns a new instance of the same type as v.
func ( Value) Value {
	if ,  := .(TypeValue);  {
		return .NewTypeValue()
	} else {
		return reflect.New(reflect.ValueOf().Elem().Type()).Interface().(Value)
	}
}

var nameValues map[string]Value

func () {
	nameValues = map[string]Value{
		"_aclitem":     &ACLItemArray{},
		"_bool":        &BoolArray{},
		"_bpchar":      &BPCharArray{},
		"_bytea":       &ByteaArray{},
		"_cidr":        &CIDRArray{},
		"_date":        &DateArray{},
		"_float4":      &Float4Array{},
		"_float8":      &Float8Array{},
		"_inet":        &InetArray{},
		"_int2":        &Int2Array{},
		"_int4":        &Int4Array{},
		"_int8":        &Int8Array{},
		"_numeric":     &NumericArray{},
		"_text":        &TextArray{},
		"_timestamp":   &TimestampArray{},
		"_timestamptz": &TimestamptzArray{},
		"_uuid":        &UUIDArray{},
		"_varchar":     &VarcharArray{},
		"_jsonb":       &JSONBArray{},
		"aclitem":      &ACLItem{},
		"bit":          &Bit{},
		"bool":         &Bool{},
		"box":          &Box{},
		"bpchar":       &BPChar{},
		"bytea":        &Bytea{},
		"char":         &QChar{},
		"cid":          &CID{},
		"cidr":         &CIDR{},
		"circle":       &Circle{},
		"date":         &Date{},
		"daterange":    &Daterange{},
		"float4":       &Float4{},
		"float8":       &Float8{},
		"hstore":       &Hstore{},
		"inet":         &Inet{},
		"int2":         &Int2{},
		"int4":         &Int4{},
		"int4range":    &Int4range{},
		"int8":         &Int8{},
		"int8range":    &Int8range{},
		"interval":     &Interval{},
		"json":         &JSON{},
		"jsonb":        &JSONB{},
		"line":         &Line{},
		"lseg":         &Lseg{},
		"macaddr":      &Macaddr{},
		"name":         &Name{},
		"numeric":      &Numeric{},
		"numrange":     &Numrange{},
		"oid":          &OIDValue{},
		"path":         &Path{},
		"point":        &Point{},
		"polygon":      &Polygon{},
		"record":       &Record{},
		"text":         &Text{},
		"tid":          &TID{},
		"timestamp":    &Timestamp{},
		"timestamptz":  &Timestamptz{},
		"tsrange":      &Tsrange{},
		"_tsrange":     &TsrangeArray{},
		"tstzrange":    &Tstzrange{},
		"_tstzrange":   &TstzrangeArray{},
		"unknown":      &Unknown{},
		"uuid":         &UUID{},
		"varbit":       &Varbit{},
		"varchar":      &Varchar{},
		"xid":          &XID{},
	}