...

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

Documentation: github.com/jackc/pgtype

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

View as plain text