func (attr *String) Scan(vr *pgx.ValueReader) error { if vr.Len() == -1 { attr.Value = "" attr.Status = Null return nil } err := pgx.Decode(vr, &attr.Value) if err != nil { return err } attr.Status = Present return vr.Err() }
func (attr *Int64) Scan(vr *pgx.ValueReader) error { if vr.Type().DataType != pgx.Int8Oid { return pgx.SerializationError(fmt.Sprintf("Int64.Scan cannot decode OID %d", vr.Type().DataType)) } if vr.Len() == -1 { attr.Value = 0 attr.Status = Null return nil } err := pgx.Decode(vr, &attr.Value) if err != nil { return err } attr.Status = Present return vr.Err() }
func (attr *IPNet) Scan(vr *pgx.ValueReader) error { oid := vr.Type().DataType if oid != pgx.InetOid && oid != pgx.CidrOid { return pgx.SerializationError(fmt.Sprintf("IPNet.Scan cannot decode OID %d", vr.Type().DataType)) } if vr.Len() == -1 { attr.Value = net.IPNet{} attr.Status = Null return nil } attr.Status = Present err := pgx.Decode(vr, &attr.Value) if err != nil { return err } return vr.Err() }
func (attr *Time) Scan(vr *pgx.ValueReader) error { oid := vr.Type().DataType if oid != pgx.TimestampTzOid && oid != pgx.TimestampOid && oid != pgx.DateOid { return pgx.SerializationError(fmt.Sprintf("Time.Scan cannot decode OID %d", vr.Type().DataType)) } if vr.Len() == -1 { attr.Value = time.Time{} attr.Status = Null return nil } err := pgx.Decode(vr, &attr.Value) if err != nil { return err } attr.Status = Present return vr.Err() }