...

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

Documentation: github.com/jackc/pgtype

     1  package pgtype
     2  
     3  import (
     4  	"database/sql/driver"
     5  )
     6  
     7  // Name is a type used for PostgreSQL's special 63-byte
     8  // name data type, used for identifiers like table names.
     9  // The pg_class.relname column is a good example of where the
    10  // name data type is used.
    11  //
    12  // Note that the underlying Go data type of pgx.Name is string,
    13  // so there is no way to enforce the 63-byte length. Inputting
    14  // a longer name into PostgreSQL will result in silent truncation
    15  // to 63 bytes.
    16  //
    17  // Also, if you have custom-compiled PostgreSQL and set
    18  // NAMEDATALEN to a different value, obviously that number of
    19  // bytes applies, rather than the default 63.
    20  type Name Text
    21  
    22  func (dst *Name) Set(src interface{}) error {
    23  	return (*Text)(dst).Set(src)
    24  }
    25  
    26  func (dst Name) Get() interface{} {
    27  	return (Text)(dst).Get()
    28  }
    29  
    30  func (src *Name) AssignTo(dst interface{}) error {
    31  	return (*Text)(src).AssignTo(dst)
    32  }
    33  
    34  func (dst *Name) DecodeText(ci *ConnInfo, src []byte) error {
    35  	return (*Text)(dst).DecodeText(ci, src)
    36  }
    37  
    38  func (dst *Name) DecodeBinary(ci *ConnInfo, src []byte) error {
    39  	return (*Text)(dst).DecodeBinary(ci, src)
    40  }
    41  
    42  func (src Name) EncodeText(ci *ConnInfo, buf []byte) ([]byte, error) {
    43  	return (Text)(src).EncodeText(ci, buf)
    44  }
    45  
    46  func (src Name) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) {
    47  	return (Text)(src).EncodeBinary(ci, buf)
    48  }
    49  
    50  // Scan implements the database/sql Scanner interface.
    51  func (dst *Name) Scan(src interface{}) error {
    52  	return (*Text)(dst).Scan(src)
    53  }
    54  
    55  // Value implements the database/sql/driver Valuer interface.
    56  func (src Name) Value() (driver.Value, error) {
    57  	return (Text)(src).Value()
    58  }
    59  

View as plain text