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