...

Source file src/github.com/jackc/pgtype/oid_value.go

Documentation: github.com/jackc/pgtype

     1  package pgtype
     2  
     3  import (
     4  	"database/sql/driver"
     5  )
     6  
     7  // OIDValue (Object Identifier Type) is, according to
     8  // https://www.postgresql.org/docs/current/static/datatype-OIDValue.html, used
     9  // internally by PostgreSQL as a primary key for various system tables. It is
    10  // currently implemented as an unsigned four-byte integer. Its definition can be
    11  // found in src/include/postgres_ext.h in the PostgreSQL sources.
    12  type OIDValue pguint32
    13  
    14  // Set converts from src to dst. Note that as OIDValue is not a general
    15  // number type Set does not do automatic type conversion as other number
    16  // types do.
    17  func (dst *OIDValue) Set(src interface{}) error {
    18  	return (*pguint32)(dst).Set(src)
    19  }
    20  
    21  func (dst OIDValue) Get() interface{} {
    22  	return (pguint32)(dst).Get()
    23  }
    24  
    25  // AssignTo assigns from src to dst. Note that as OIDValue is not a general number
    26  // type AssignTo does not do automatic type conversion as other number types do.
    27  func (src *OIDValue) AssignTo(dst interface{}) error {
    28  	return (*pguint32)(src).AssignTo(dst)
    29  }
    30  
    31  func (dst *OIDValue) DecodeText(ci *ConnInfo, src []byte) error {
    32  	return (*pguint32)(dst).DecodeText(ci, src)
    33  }
    34  
    35  func (dst *OIDValue) DecodeBinary(ci *ConnInfo, src []byte) error {
    36  	return (*pguint32)(dst).DecodeBinary(ci, src)
    37  }
    38  
    39  func (src OIDValue) EncodeText(ci *ConnInfo, buf []byte) ([]byte, error) {
    40  	return (pguint32)(src).EncodeText(ci, buf)
    41  }
    42  
    43  func (src OIDValue) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) {
    44  	return (pguint32)(src).EncodeBinary(ci, buf)
    45  }
    46  
    47  // Scan implements the database/sql Scanner interface.
    48  func (dst *OIDValue) Scan(src interface{}) error {
    49  	return (*pguint32)(dst).Scan(src)
    50  }
    51  
    52  // Value implements the database/sql/driver Valuer interface.
    53  func (src OIDValue) Value() (driver.Value, error) {
    54  	return (pguint32)(src).Value()
    55  }
    56  

View as plain text