Source File
pguint32.go
Belonging Package
github.com/jackc/pgtype
package pgtype
import (
)
func ( *pguint32) ( interface{}) error {
switch value := .(type) {
case int64:
if < 0 {
return fmt.Errorf("%d is less than minimum value for pguint32", )
}
if > math.MaxUint32 {
return fmt.Errorf("%d is greater than maximum value for pguint32", )
}
* = pguint32{Uint: uint32(), Status: Present}
case uint32:
* = pguint32{Uint: , Status: Present}
default:
return fmt.Errorf("cannot convert %v to pguint32", )
}
return nil
}
func ( pguint32) () interface{} {
switch .Status {
case Present:
return .Uint
case Null:
return nil
default:
return .Status
}
}
func ( *pguint32) ( interface{}) error {
switch v := .(type) {
case *uint32:
if .Status == Present {
* = .Uint
} else {
return fmt.Errorf("cannot assign %v into %T", , )
}
case **uint32:
if .Status == Present {
:= .Uint
* = &
} else {
* = nil
}
}
return nil
}
func ( *pguint32) ( *ConnInfo, []byte) error {
if == nil {
* = pguint32{Status: Null}
return nil
}
, := strconv.ParseUint(string(), 10, 32)
if != nil {
return
}
* = pguint32{Uint: uint32(), Status: Present}
return nil
}
func ( *pguint32) ( *ConnInfo, []byte) error {
if == nil {
* = pguint32{Status: Null}
return nil
}
if len() != 4 {
return fmt.Errorf("invalid length: %v", len())
}
:= binary.BigEndian.Uint32()
* = pguint32{Uint: , Status: Present}
return nil
}
func ( pguint32) ( *ConnInfo, []byte) ([]byte, error) {
switch .Status {
case Null:
return nil, nil
case Undefined:
return nil, errUndefined
}
return append(, strconv.FormatUint(uint64(.Uint), 10)...), nil
}
func ( pguint32) ( *ConnInfo, []byte) ([]byte, error) {
switch .Status {
case Null:
return nil, nil
case Undefined:
return nil, errUndefined
}
return pgio.AppendUint32(, .Uint), nil
}
func ( *pguint32) ( interface{}) error {
if == nil {
* = pguint32{Status: Null}
return nil
}
switch src := .(type) {
case uint32:
* = pguint32{Uint: , Status: Present}
return nil
case int64:
* = pguint32{Uint: uint32(), Status: Present}
return nil
case string:
return .DecodeText(nil, []byte())
case []byte:
:= make([]byte, len())
copy(, )
return .DecodeText(nil, )
}
return fmt.Errorf("cannot scan %T", )
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |