package pgtype

import (
	
	
	
	

	
)
OID (Object Identifier Type) is, according to https://www.postgresql.org/docs/current/static/datatype-oid.html, used internally by PostgreSQL as a primary key for various system tables. It is currently implemented as an unsigned four-byte integer. Its definition can be found in src/include/postgres_ext.h in the PostgreSQL sources. Because it is so frequently required to be in a NOT NULL condition OID cannot be NULL. To allow for NULL OIDs use OIDValue.
type OID uint32

func ( *OID) ( *ConnInfo,  []byte) error {
	if  == nil {
		return fmt.Errorf("cannot decode nil into OID")
	}

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

	* = OID()
	return nil
}

func ( *OID) ( *ConnInfo,  []byte) error {
	if  == nil {
		return fmt.Errorf("cannot decode nil into OID")
	}

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

	 := binary.BigEndian.Uint32()
	* = OID()
	return nil
}

func ( OID) ( *ConnInfo,  []byte) ([]byte, error) {
	return append(, strconv.FormatUint(uint64(), 10)...), nil
}

func ( OID) ( *ConnInfo,  []byte) ([]byte, error) {
	return pgio.AppendUint32(, uint32()), nil
}
Scan implements the database/sql Scanner interface.
func ( *OID) ( interface{}) error {
	if  == nil {
		return fmt.Errorf("cannot scan NULL into %T", )
	}

	switch src := .(type) {
	case int64:
		* = OID()
		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 ( OID) () (driver.Value, error) {
	return int64(), nil