package pgtype

import (
	
	
	
	
	

	
)
pguint32 is the core type that is used to implement PostgreSQL types such as CID and XID.
type pguint32 struct {
	Uint   uint32
	Status Status
}
Set converts from src to dst. Note that as pguint32 is not a general number type Set does not do automatic type conversion as other number types do.
func ( *pguint32) ( interface{}) error {
	switch value := .(type) {
	case int64:
		if  < 0 {
			return fmt.Errorf("%d is less than minimum value for pguint32", )
		}
		if  > math.MaxUint32 {
			return fmt.Errorf("%d is greater than maximum value for pguint32", )
		}
		* = pguint32{Uint: uint32(), Status: Present}
	case uint32:
		* = pguint32{Uint: , Status: Present}
	default:
		return fmt.Errorf("cannot convert %v to pguint32", )
	}

	return nil
}

func ( pguint32) () interface{} {
	switch .Status {
	case Present:
		return .Uint
	case Null:
		return nil
	default:
		return .Status
	}
}
AssignTo assigns from src to dst. Note that as pguint32 is not a general number type AssignTo does not do automatic type conversion as other number types do.
func ( *pguint32) ( interface{}) error {
	switch v := .(type) {
	case *uint32:
		if .Status == Present {
			* = .Uint
		} else {
			return fmt.Errorf("cannot assign %v into %T", , )
		}
	case **uint32:
		if .Status == Present {
			 := .Uint
			* = &
		} else {
			* = nil
		}
	}

	return nil
}

func ( *pguint32) ( *ConnInfo,  []byte) error {
	if  == nil {
		* = pguint32{Status: Null}
		return nil
	}

	,  := strconv.ParseUint(string(), 10, 32)
	if  != nil {
		return 
	}

	* = pguint32{Uint: uint32(), Status: Present}
	return nil
}

func ( *pguint32) ( *ConnInfo,  []byte) error {
	if  == nil {
		* = pguint32{Status: Null}
		return nil
	}

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

	 := binary.BigEndian.Uint32()
	* = pguint32{Uint: , Status: Present}
	return nil
}

func ( pguint32) ( *ConnInfo,  []byte) ([]byte, error) {
	switch .Status {
	case Null:
		return nil, nil
	case Undefined:
		return nil, errUndefined
	}

	return append(, strconv.FormatUint(uint64(.Uint), 10)...), nil
}

func ( pguint32) ( *ConnInfo,  []byte) ([]byte, error) {
	switch .Status {
	case Null:
		return nil, nil
	case Undefined:
		return nil, errUndefined
	}

	return pgio.AppendUint32(, .Uint), nil
}
Scan implements the database/sql Scanner interface.
func ( *pguint32) ( interface{}) error {
	if  == nil {
		* = pguint32{Status: Null}
		return nil
	}

	switch src := .(type) {
	case uint32:
		* = pguint32{Uint: , Status: Present}
		return nil
	case int64:
		* = pguint32{Uint: uint32(), Status: Present}
		return nil
	case string:
		return .DecodeText(nil, []byte())
	case []byte:
		 := make([]byte, len())
		copy(, )
		return .DecodeText(nil, )
	}

	return fmt.Errorf("cannot scan %T", )
}
Value implements the database/sql/driver Valuer interface.
func ( pguint32) () (driver.Value, error) {
	switch .Status {
	case Present:
		return int64(.Uint), nil
	case Null:
		return nil, nil
	default:
		return nil, errUndefined
	}