...

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

Documentation: github.com/jackc/pgtype

     1  package pgtype
     2  
     3  import (
     4  	"database/sql/driver"
     5  )
     6  
     7  // CID is PostgreSQL's Command Identifier type.
     8  //
     9  // When one does
    10  //
    11  // 	select cmin, cmax, * from some_table;
    12  //
    13  // it is the data type of the cmin and cmax hidden system columns.
    14  //
    15  // It is currently implemented as an unsigned four byte integer.
    16  // Its definition can be found in src/include/c.h as CommandId
    17  // in the PostgreSQL sources.
    18  type CID pguint32
    19  
    20  // Set converts from src to dst. Note that as CID is not a general
    21  // number type Set does not do automatic type conversion as other number
    22  // types do.
    23  func (dst *CID) Set(src interface{}) error {
    24  	return (*pguint32)(dst).Set(src)
    25  }
    26  
    27  func (dst CID) Get() interface{} {
    28  	return (pguint32)(dst).Get()
    29  }
    30  
    31  // AssignTo assigns from src to dst. Note that as CID is not a general number
    32  // type AssignTo does not do automatic type conversion as other number types do.
    33  func (src *CID) AssignTo(dst interface{}) error {
    34  	return (*pguint32)(src).AssignTo(dst)
    35  }
    36  
    37  func (dst *CID) DecodeText(ci *ConnInfo, src []byte) error {
    38  	return (*pguint32)(dst).DecodeText(ci, src)
    39  }
    40  
    41  func (dst *CID) DecodeBinary(ci *ConnInfo, src []byte) error {
    42  	return (*pguint32)(dst).DecodeBinary(ci, src)
    43  }
    44  
    45  func (src CID) EncodeText(ci *ConnInfo, buf []byte) ([]byte, error) {
    46  	return (pguint32)(src).EncodeText(ci, buf)
    47  }
    48  
    49  func (src CID) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) {
    50  	return (pguint32)(src).EncodeBinary(ci, buf)
    51  }
    52  
    53  // Scan implements the database/sql Scanner interface.
    54  func (dst *CID) Scan(src interface{}) error {
    55  	return (*pguint32)(dst).Scan(src)
    56  }
    57  
    58  // Value implements the database/sql/driver Valuer interface.
    59  func (src CID) Value() (driver.Value, error) {
    60  	return (pguint32)(src).Value()
    61  }
    62  

View as plain text