null

package
v0.0.0-...-581c8d3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package null contains types which can be NULL in some storage engines.

The aim is to import database/sql to avoid the dependency on SQL. Null values can occur everywhere hence we want to keep the deps minimal.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthNull = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowNull   = fmt.Errorf("proto: integer overflow")
)
View Source
var AllTypes = [...]interface{}{Bool{}, Decimal{}, Float64{}, Int8{}, Int16{}, Int32{}, Int64{}, String{}, Time{}, Uint8{}, Uint16{}, Uint32{}, Uint64{}}

AllTypes contains value objects of all types in this package. The array might change in size in the future. The types are useful for functions like: gopkg.in/go-playground/validator.v9/Validate.RegisterCustomTypeFunc or gob.Register.

Functions

func MustSetJSONMarshaler

func MustSetJSONMarshaler(marshalFn func(v interface{}) ([]byte, error), unMarshalFn func(data []byte, v interface{}) error)

MustSetJSONMarshaler applies the global JSON marshal functions for encoding and decoding. This function can only be called once. It panics on multiple calls.

Types

type Bool

type Bool struct {
	Bool  bool
	Valid bool // Valid is true if Bool is not NULL
}

Bool is a nullable bool. It does not consider false values to be null. It will decode to null, not false, if null. Bool implements interface Argument.

func MakeBool

func MakeBool(b bool) Bool

MakeBool creates a new Bool. Implements interface Argument.

func MakeBoolFromByte

func MakeBoolFromByte(data []byte) (nv Bool, err error)

MakeBoolFromByte makes a new Bool from a (text) byte slice.

func MakeBoolPtr

func MakeBoolPtr(b bool) *Bool

MakeBoolPtr creates a new Bool pointer. Implements interface Argument.

func (Bool) Append

func (a Bool) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Bool) Descriptor

func (*Bool) Descriptor() ([]byte, []int)

func (Bool) GoString

func (a Bool) GoString() string

GoString prints an optimized Go representation.

func (Bool) IsZero

func (a Bool) IsZero() bool

IsZero returns true for invalid Bools, for future omitempty support (Go 1.4?) A non-null Bool with a 0 value will not be considered zero.

func (*Bool) Marshal

func (m *Bool) Marshal() (dAtA []byte, err error)

func (Bool) MarshalBinary

func (a Bool) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Bool) MarshalJSON

func (a Bool) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Bool is null.

func (Bool) MarshalText

func (a Bool) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Bool is null.

func (*Bool) MarshalTo

func (m *Bool) MarshalTo(dAtA []byte) (int, error)

func (*Bool) MarshalToSizedBuffer

func (m *Bool) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Bool) ProtoMessage

func (*Bool) ProtoMessage()

func (Bool) Ptr

func (a Bool) Ptr() *bool

Ptr returns a pointer to this Bool's value, or a nil pointer if this Bool is null.

func (*Bool) Reset

func (m *Bool) Reset()

func (*Bool) Scan

func (a *Bool) Scan(value interface{}) (err error)

Scan implements the Scanner interface.

func (Bool) SetNull

func (a Bool) SetNull() Bool

SetNull sets the value to Go's default value and Valid to false.

func (Bool) SetValid

func (a Bool) SetValid(v bool) Bool

SetValid changes this Bool's value and also sets it to be non-null.

func (Bool) Size

func (m Bool) Size() (n int)

func (Bool) String

func (a Bool) String() string

GoString prints an optimized Go representation.

func (*Bool) Unmarshal

func (m *Bool) Unmarshal(dAtA []byte) error

func (*Bool) UnmarshalBinary

func (a *Bool) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Bool) UnmarshalJSON

func (a *Bool) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Bool. It also supports unmarshalling a sql.Bool.

func (*Bool) UnmarshalText

func (a *Bool) UnmarshalText(text []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Bool if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or "null".

func (Bool) Value

func (a Bool) Value() (driver.Value, error)

Value implements the driver Valuer interface.

func (Bool) WriteTo

func (a Bool) WriteTo(d Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Bool) XXX_DiscardUnknown

func (m *Bool) XXX_DiscardUnknown()

func (*Bool) XXX_Marshal

func (m *Bool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Bool) XXX_Merge

func (m *Bool) XXX_Merge(src proto.Message)

func (*Bool) XXX_Size

func (m *Bool) XXX_Size() int

func (*Bool) XXX_Unmarshal

func (m *Bool) XXX_Unmarshal(b []byte) error

type Decimal

type Decimal struct {
	PrecisionStr string // Not empty if to large for an uint64
	Precision    uint64 // The value itself, always set if it fits into an uint64
	Scale        int32  // Number of digits after the dot
	Negative     bool
	Valid        bool
	// Quote if true JSON marshaling will quote the returned number and creates
	// a string. JavaScript floats are only 53 bits.
	Quote bool
	// contains filtered or unexported fields
}

Decimal defines a container type for any MySQL/MariaDB decimal/numeric/float/double data type and their representation in Go. It can store arbitrary large values. Decimal does not perform any kind of calculations. Helpful packages for arbitrary precision calculations are github.com/ericlagergren/decimal or gopkg.in/inf.v0 or github.com/shopspring/decimal or a future new Go type. https://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html https://dev.mysql.com/doc/refman/5.7/en/floating-point-types.html

func MakeDecimalBytes

func MakeDecimalBytes(b []byte) (d Decimal, err error)

MakeDecimalBytes parses b to create a new Decimal. b must contain ASCII numbers. If b contains null/NULL the returned object represents that value. This function can be used for big.Int.Bytes() or similar implementations. Parses only numbers as stored in MySQL/MariaDB decimal/double column format, e.g. -47.11.

func MakeDecimalFloat64

func MakeDecimalFloat64(value float64) (d Decimal, err error)

MakeDecimalFloat64 converts a float64 to Decimal.

Example:

MakeDecimalFloat64(123.45678901234567).String()  // output: "123.45678901234567"
MakeDecimalFloat64(123.456789012345678).String() // output: "123.45678901234568"
MakeDecimalFloat64(.00000000000000001).String() // output: "0.00000000000000001"

func MakeDecimalInt64

func MakeDecimalInt64(value int64, scale int32) Decimal

MakeDecimalInt64 converts an int64 with the scale to a Decimal.

func MakeDecimalInt64Ptr

func MakeDecimalInt64Ptr(value int64, scale int32) *Decimal

MakeDecimalInt64Ptr converts an int64 with the scale to a Decimal.

func MustMakeDecimalBytes

func MustMakeDecimalBytes(data []byte) Decimal

MustMakeDecimalBytes same behaviour as MakeDecimalBytes but panics on error.

func MustMakeDecimalBytesPtr

func MustMakeDecimalBytesPtr(data []byte) *Decimal

MustMakeDecimalBytesPtr same behaviour as MakeDecimalBytes but panics on error.

func (*Decimal) Descriptor

func (*Decimal) Descriptor() ([]byte, []int)

func (Decimal) Equal

func (d Decimal) Equal(d2 Decimal) bool

Equal compares another Decimal object for equality. Equality can only succeed when both `Valid` fields are true.

func (*Decimal) Fake

func (d *Decimal) Fake(fieldName string) (hasFakeDataApplied bool, err error)

Fake implements pseudo.Faker interface to generate custom fake data for specific fields. In this case field PrecisionStr should not contain random fake data at all or we need to generate correct fake data.

func (Decimal) Float64

func (d Decimal) Float64() (value float64)

Float64 converts the precision and the scale to a float64 value including the usual float behaviour. Overflow will result in an undefined float64.

func (Decimal) GoString

func (d Decimal) GoString() string

GoString returns an optimized version of the Go representation of Decimal.

func (Decimal) Int64

func (d Decimal) Int64() (value int64, scale int32)

Int64 converts the underlying uint64 to an int64. Very useful for creating a new 3rd party package type/object. If the Precision field overflows math.MaxInt64 the return values are 0,0. If you want to aovid this use the String function and create the 3rd party type via the string.

func (*Decimal) Marshal

func (d *Decimal) Marshal() (dAtA []byte, err error)

func (Decimal) MarshalBinary

func (d Decimal) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Decimal) MarshalJSON

func (d Decimal) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Decimal) MarshalText

func (d Decimal) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface for XML serialization. Does not support quoting. An invalid type returns an empty string.

func (*Decimal) MarshalTo

func (d *Decimal) MarshalTo(dAtA []byte) (int, error)

func (*Decimal) MarshalToSizedBuffer

func (d *Decimal) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Decimal) ProtoMessage

func (*Decimal) ProtoMessage()

func (*Decimal) Reset

func (d *Decimal) Reset()

func (*Decimal) Scan

func (d *Decimal) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >3x times faster than database/sql.convertAssign.

func (Decimal) SetNull

func (d Decimal) SetNull() Decimal

SetNull sets the value to Go's default value and Valid to false.

func (Decimal) Size

func (d Decimal) Size() (n int)

func (Decimal) String

func (d Decimal) String() string

String returns the string representation of the fixed with decimal. Returns the word `NULL` if the current value is not valid, for now.

func (*Decimal) Unmarshal

func (d *Decimal) Unmarshal(dAtA []byte) error

func (*Decimal) UnmarshalBinary

func (d *Decimal) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. As a string representation is already used when encoding to text, this method stores that string as []byte

func (*Decimal) UnmarshalJSON

func (d *Decimal) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Decimal) UnmarshalText

func (d *Decimal) UnmarshalText(text []byte) (err error)

UnmarshalText implements the encoding.TextUnmarshaler interface for XML deserialization.

func (Decimal) Value

func (d Decimal) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization. It stores a string in driver.Value.

func (*Decimal) XXX_DiscardUnknown

func (d *Decimal) XXX_DiscardUnknown()

func (*Decimal) XXX_Marshal

func (d *Decimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Decimal) XXX_Merge

func (d *Decimal) XXX_Merge(src proto.Message)

func (*Decimal) XXX_Size

func (d *Decimal) XXX_Size() int

func (*Decimal) XXX_Unmarshal

func (d *Decimal) XXX_Unmarshal(b []byte) error

type Dialecter

type Dialecter interface {
	EscapeIdent(w *bytes.Buffer, ident string)
	EscapeBool(w *bytes.Buffer, b bool)
	EscapeString(w *bytes.Buffer, s string)
	EscapeTime(w *bytes.Buffer, t time.Time)
	EscapeBinary(w *bytes.Buffer, b []byte)
}

Dialecter at an interface that wraps the diverse properties of individual SQL drivers.

type Float64

type Float64 struct {
	Float64 float64
	Valid   bool // Valid is true if Float64 is not NULL
}

Float64 is a nullable float64. It does not consider zero values to be null. It will decode to null, not zero, if null.

func MakeFloat64

func MakeFloat64(f float64) Float64

MakeFloat64 creates a new Float64. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Float64 implements interface Argument.

func MakeFloat64FromByte

func MakeFloat64FromByte(data []byte) (nv Float64, err error)

MakeFloat64FromByte makes a new Float64 from a (text) byte slice.

func MakeFloat64Ptr

func MakeFloat64Ptr(f float64) *Float64

MakeFloat64Ptr creates a new Float64. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Float64 implements interface Argument.

func (Float64) Append

func (a Float64) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Float64) Descriptor

func (*Float64) Descriptor() ([]byte, []int)

func (Float64) GoString

func (a Float64) GoString() string

GoString prints an optimized Go representation.

func (Float64) IsZero

func (a Float64) IsZero() bool

IsZero returns true for invalid Float64s, for future omitempty support (Go 1.4?) A non-null Float64 with a 0 value will not be considered zero.

func (*Float64) Marshal

func (m *Float64) Marshal() (dAtA []byte, err error)

func (Float64) MarshalBinary

func (a Float64) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Float64) MarshalJSON

func (a Float64) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Float64 is null.

func (Float64) MarshalText

func (a Float64) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Float64 is null.

func (*Float64) MarshalTo

func (m *Float64) MarshalTo(dAtA []byte) (int, error)

func (*Float64) MarshalToSizedBuffer

func (m *Float64) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Float64) ProtoMessage

func (*Float64) ProtoMessage()

func (Float64) Ptr

func (a Float64) Ptr() *float64

Ptr returns a pointer to this Float64's value, or a nil pointer if this Float64 is null.

func (*Float64) Reset

func (m *Float64) Reset()

func (*Float64) Scan

func (a *Float64) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >3x times faster than database/sql.convertAssign.

func (Float64) SetNull

func (a Float64) SetNull() Float64

SetNull sets the value to Go's default value and Valid to false.

func (Float64) SetValid

func (a Float64) SetValid(n float64) Float64

SetValid changes this Float64's value and also sets it to be non-null.

func (Float64) Size

func (m Float64) Size() (n int)

func (Float64) String

func (a Float64) String() string

String returns the string representation of the float or null.

func (*Float64) Unmarshal

func (m *Float64) Unmarshal(dAtA []byte) error

func (*Float64) UnmarshalBinary

func (a *Float64) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Float64) UnmarshalJSON

func (a *Float64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Float64. It also supports unmarshalling a sql.Float64.

func (*Float64) UnmarshalText

func (a *Float64) UnmarshalText(text []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Float64 if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or "null".

func (Float64) Value

func (a Float64) Value() (driver.Value, error)

Value implements the driver Valuer interface.

func (Float64) WriteTo

func (a Float64) WriteTo(_ Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Float64) XXX_DiscardUnknown

func (m *Float64) XXX_DiscardUnknown()

func (*Float64) XXX_Marshal

func (m *Float64) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Float64) XXX_Merge

func (m *Float64) XXX_Merge(src proto.Message)

func (*Float64) XXX_Size

func (m *Float64) XXX_Size() int

func (*Float64) XXX_Unmarshal

func (m *Float64) XXX_Unmarshal(b []byte) error

type Int16

type Int16 struct {
	Int16 int16
	Valid bool // Valid is true if Int16 is not NULL
}

Int16 is a nullable int16. It does not consider zero values to be null. It will decode to null, not zero, if null. Int16 implements interface Argument.

func MakeInt16

func MakeInt16(i int16) Int16

MakeInt16 creates a new Int16. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Int16 implements interface Argument.

func MakeInt16FromByte

func MakeInt16FromByte(data []byte) (nv Int16, err error)

MakeInt16FromByte makes a new Int16 from a (text) byte slice.

func MakeInt16Ptr

func MakeInt16Ptr(i int16) *Int16

MakeInt16Ptr creates a new Int16. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Int16 implements interface Argument.

func (Int16) Append

func (a Int16) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Int16) Descriptor

func (*Int16) Descriptor() ([]byte, []int)

func (Int16) GoString

func (a Int16) GoString() string

GoString prints an optimized Go representation. Takes are of backticks.

func (Int16) IsZero

func (a Int16) IsZero() bool

IsZero returns true for invalid Int16's, for future omitempty support (Go 1.4?) A non-null Int16 with a 0 value will not be considered zero.

func (*Int16) Marshal

func (m *Int16) Marshal() (dAtA []byte, err error)

func (Int16) MarshalBinary

func (a Int16) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Int16) MarshalJSON

func (a Int16) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Int16 is null.

func (Int16) MarshalText

func (a Int16) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Int16 is null.

func (*Int16) MarshalTo

func (m *Int16) MarshalTo(dAtA []byte) (int, error)

func (*Int16) MarshalToSizedBuffer

func (m *Int16) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Int16) ProtoMessage

func (*Int16) ProtoMessage()

func (Int16) Ptr

func (a Int16) Ptr() *int16

Ptr returns a pointer to this Int16's value, or a nil pointer if this Int16 is null.

func (*Int16) Reset

func (m *Int16) Reset()

func (*Int16) Scan

func (a *Int16) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >3x times faster than database/sql.convertAssign.

func (Int16) SetNull

func (a Int16) SetNull() Int16

SetNull sets the value to Go's default value and Valid to false.

func (Int16) SetValid

func (a Int16) SetValid(n int16) Int16

SetValid changes this Int16's value and also sets it to be non-null.

func (Int16) Size

func (m Int16) Size() (n int)

func (Int16) String

func (a Int16) String() string

String returns the string representation of the int or null.

func (*Int16) Unmarshal

func (m *Int16) Unmarshal(dAtA []byte) error

func (*Int16) UnmarshalBinary

func (a *Int16) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Int16) UnmarshalJSON

func (a *Int16) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Int16. It also supports unmarshalling a sql.Int16.

func (*Int16) UnmarshalText

func (a *Int16) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Int16 if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or sqlStrNullLC.

func (Int16) Value

func (a Int16) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

func (Int16) WriteTo

func (a Int16) WriteTo(_ Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Int16) XXX_DiscardUnknown

func (m *Int16) XXX_DiscardUnknown()

func (*Int16) XXX_Marshal

func (m *Int16) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Int16) XXX_Merge

func (m *Int16) XXX_Merge(src proto.Message)

func (*Int16) XXX_Size

func (m *Int16) XXX_Size() int

func (*Int16) XXX_Unmarshal

func (m *Int16) XXX_Unmarshal(b []byte) error

type Int32

type Int32 struct {
	sql.NullInt32
}

Int32 is a nullable int32. It does not consider zero values to be null. It will decode to null, not zero, if null. Int32 implements interface Argument.

func MakeInt32

func MakeInt32(i int32) Int32

MakeInt32 creates a new Int32. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Int32 implements interface Argument.

func MakeInt32FromByte

func MakeInt32FromByte(data []byte) (nv Int32, err error)

MakeInt32FromByte makes a new Int32 from a (text) byte slice.

func MakeInt32Ptr

func MakeInt32Ptr(i int32) *Int32

MakeInt32Ptr creates a new Int32. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Int32 implements interface Argument.

func (Int32) Append

func (a Int32) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Int32) Descriptor

func (*Int32) Descriptor() ([]byte, []int)

func (Int32) GoString

func (a Int32) GoString() string

GoString prints an optimized Go representation. Takes are of backticks.

func (Int32) IsZero

func (a Int32) IsZero() bool

IsZero returns true for invalid Int32's, for future omitempty support (Go 1.4?) A non-null Int32 with a 0 value will not be considered zero.

func (*Int32) Marshal

func (m *Int32) Marshal() (dAtA []byte, err error)

func (Int32) MarshalBinary

func (a Int32) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Int32) MarshalJSON

func (a Int32) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Int32 is null.

func (Int32) MarshalText

func (a Int32) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Int32 is null.

func (*Int32) MarshalTo

func (m *Int32) MarshalTo(dAtA []byte) (int, error)

func (*Int32) MarshalToSizedBuffer

func (m *Int32) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Int32) ProtoMessage

func (*Int32) ProtoMessage()

func (Int32) Ptr

func (a Int32) Ptr() *int32

Ptr returns a pointer to this Int32's value, or a nil pointer if this Int32 is null.

func (*Int32) Reset

func (m *Int32) Reset()

func (*Int32) Scan

func (a *Int32) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >3x times faster than database/sql.convertAssign.

func (Int32) SetNull

func (a Int32) SetNull() Int32

SetNull sets the value to Go's default value and Valid to false.

func (Int32) SetValid

func (a Int32) SetValid(n int32) Int32

SetValid changes this Int32's value and also sets it to be non-null.

func (Int32) Size

func (m Int32) Size() (n int)

func (Int32) String

func (a Int32) String() string

String returns the string representation of the int or null.

func (*Int32) Unmarshal

func (m *Int32) Unmarshal(dAtA []byte) error

func (*Int32) UnmarshalBinary

func (a *Int32) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Int32) UnmarshalJSON

func (a *Int32) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Int32. It also supports unmarshalling a sql.Int32.

func (*Int32) UnmarshalText

func (a *Int32) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Int32 if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or sqlStrNullLC.

func (Int32) WriteTo

func (a Int32) WriteTo(_ Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Int32) XXX_DiscardUnknown

func (m *Int32) XXX_DiscardUnknown()

func (*Int32) XXX_Marshal

func (m *Int32) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Int32) XXX_Merge

func (m *Int32) XXX_Merge(src proto.Message)

func (*Int32) XXX_Size

func (m *Int32) XXX_Size() int

func (*Int32) XXX_Unmarshal

func (m *Int32) XXX_Unmarshal(b []byte) error

type Int64

type Int64 struct {
	Int64 int64
	Valid bool // Valid is true if Int64 is not NULL
}

Int64 is a nullable int64. It does not consider zero values to be null. It will decode to null, not zero, if null. Int64 implements interface Argument.

func MakeInt64

func MakeInt64(i int64) Int64

MakeInt64 creates a new Int64. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Int64 implements interface Argument.

func MakeInt64FromByte

func MakeInt64FromByte(data []byte) (nv Int64, err error)

MakeInt64FromByte makes a new Int64 from a (text) byte slice.

func MakeInt64Ptr

func MakeInt64Ptr(i int64) *Int64

MakeInt64Ptr creates a new Int64. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Int64 implements interface Argument.

func (Int64) Append

func (a Int64) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Int64) Descriptor

func (*Int64) Descriptor() ([]byte, []int)

func (Int64) GoString

func (a Int64) GoString() string

GoString prints an optimized Go representation. Takes are of backticks.

func (Int64) IsZero

func (a Int64) IsZero() bool

IsZero returns true for invalid Int64's, for future omitempty support (Go 1.4?) A non-null Int64 with a 0 value will not be considered zero.

func (*Int64) Marshal

func (m *Int64) Marshal() (dAtA []byte, err error)

func (Int64) MarshalBinary

func (a Int64) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Int64) MarshalJSON

func (a Int64) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Int64 is null.

func (Int64) MarshalText

func (a Int64) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Int64 is null.

func (*Int64) MarshalTo

func (m *Int64) MarshalTo(dAtA []byte) (int, error)

func (*Int64) MarshalToSizedBuffer

func (m *Int64) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Int64) ProtoMessage

func (*Int64) ProtoMessage()

func (Int64) Ptr

func (a Int64) Ptr() *int64

Ptr returns a pointer to this Int64's value, or a nil pointer if this Int64 is null.

func (*Int64) Reset

func (m *Int64) Reset()

func (*Int64) Scan

func (a *Int64) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >3x times faster than database/sql.convertAssign.

func (Int64) SetNull

func (a Int64) SetNull() Int64

SetNull sets the value to Go's default value and Valid to false.

func (Int64) SetValid

func (a Int64) SetValid(n int64) Int64

SetValid changes this Int64's value and also sets it to be non-null.

func (Int64) Size

func (m Int64) Size() (n int)

func (Int64) String

func (a Int64) String() string

String returns the string representation of the int or null.

func (*Int64) Unmarshal

func (m *Int64) Unmarshal(dAtA []byte) error

func (*Int64) UnmarshalBinary

func (a *Int64) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Int64) UnmarshalJSON

func (a *Int64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Int64. It also supports unmarshalling a sql.Int64.

func (*Int64) UnmarshalText

func (a *Int64) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Int64 if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or sqlStrNullLC.

func (Int64) Value

func (a Int64) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

func (Int64) WriteTo

func (a Int64) WriteTo(_ Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Int64) XXX_DiscardUnknown

func (m *Int64) XXX_DiscardUnknown()

func (*Int64) XXX_Marshal

func (m *Int64) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Int64) XXX_Merge

func (m *Int64) XXX_Merge(src proto.Message)

func (*Int64) XXX_Size

func (m *Int64) XXX_Size() int

func (*Int64) XXX_Unmarshal

func (m *Int64) XXX_Unmarshal(b []byte) error

type Int8

type Int8 struct {
	Int8  int8
	Valid bool // Valid is true if Int8 is not NULL
}

Int8 is a nullable int8. It does not consider zero values to be null. It will decode to null, not zero, if null. Int8 implements interface Argument.

func MakeInt8

func MakeInt8(i int8) Int8

MakeInt8 creates a new Int8. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Int8 implements interface Argument.

func MakeInt8FromByte

func MakeInt8FromByte(data []byte) (nv Int8, err error)

MakeInt8FromByte makes a new Int8 from a (text) byte slice.

func MakeInt8Ptr

func MakeInt8Ptr(i int8) *Int8

MakeInt8Ptr creates a new Int8. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Int8 implements interface Argument.

func (Int8) Append

func (a Int8) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Int8) Descriptor

func (*Int8) Descriptor() ([]byte, []int)

func (Int8) GoString

func (a Int8) GoString() string

GoString prints an optimized Go representation. Takes are of backticks.

func (Int8) IsZero

func (a Int8) IsZero() bool

IsZero returns true for invalid Int8's, for future omitempty support (Go 1.4?) A non-null Int8 with a 0 value will not be considered zero.

func (*Int8) Marshal

func (m *Int8) Marshal() (dAtA []byte, err error)

func (Int8) MarshalBinary

func (a Int8) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Int8) MarshalJSON

func (a Int8) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Int8 is null.

func (Int8) MarshalText

func (a Int8) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Int8 is null.

func (*Int8) MarshalTo

func (m *Int8) MarshalTo(dAtA []byte) (int, error)

func (*Int8) MarshalToSizedBuffer

func (m *Int8) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Int8) ProtoMessage

func (*Int8) ProtoMessage()

func (Int8) Ptr

func (a Int8) Ptr() *int8

Ptr returns a pointer to this Int8's value, or a nil pointer if this Int8 is null.

func (*Int8) Reset

func (m *Int8) Reset()

func (*Int8) Scan

func (a *Int8) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >3x times faster than database/sql.convertAssign.

func (Int8) SetNull

func (a Int8) SetNull() Int8

SetNull sets the value to Go's default value and Valid to false.

func (Int8) SetValid

func (a Int8) SetValid(n int8) Int8

SetValid changes this Int8's value and also sets it to be non-null.

func (Int8) Size

func (m Int8) Size() (n int)

func (Int8) String

func (a Int8) String() string

String returns the string representation of the int or null.

func (*Int8) Unmarshal

func (m *Int8) Unmarshal(dAtA []byte) error

func (*Int8) UnmarshalBinary

func (a *Int8) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Int8) UnmarshalJSON

func (a *Int8) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Int8. It also supports unmarshalling a sql.Int8.

func (*Int8) UnmarshalText

func (a *Int8) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Int8 if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or sqlStrNullLC.

func (Int8) Value

func (a Int8) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

func (Int8) WriteTo

func (a Int8) WriteTo(_ Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Int8) XXX_DiscardUnknown

func (m *Int8) XXX_DiscardUnknown()

func (*Int8) XXX_Marshal

func (m *Int8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Int8) XXX_Merge

func (m *Int8) XXX_Merge(src proto.Message)

func (*Int8) XXX_Size

func (m *Int8) XXX_Size() int

func (*Int8) XXX_Unmarshal

func (m *Int8) XXX_Unmarshal(b []byte) error

type String

type String struct {
	// Data should be called String but there is String() method or should be
	// called Value but there is a Value() method. Now it's called Data because
	// there is no Data() method. Calling it Str would be weird...
	Data  string
	Valid bool // Valid is true if String is not NULL
}

String is a nullable string. It supports SQL and JSON serialization. It will marshal to null if null. Blank string input will be considered null. String implements interface Argument.

func MakeString

func MakeString(s string) String

MakeString creates a new String. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. String implements interface Argument.

func MakeStringPtr

func MakeStringPtr(s string) *String

MakeStringPtr creates a new String. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. String implements interface Argument.

func (String) Append

func (a String) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*String) Descriptor

func (*String) Descriptor() ([]byte, []int)

func (String) GoString

func (a String) GoString() string

GoString prints an optimized Go representation. Takes are of backticks. Looses the information of the private operator. That might get fixed.

func (String) IsZero

func (a String) IsZero() bool

IsZero returns true for null strings, for potential future omitempty support.

func (*String) Marshal

func (a *String) Marshal() (dAtA []byte, err error)

func (String) MarshalBinary

func (a String) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (String) MarshalJSON

func (a String) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this String is null.

func (String) MarshalText

func (a String) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string when this String is null.

func (*String) MarshalTo

func (a *String) MarshalTo(dAtA []byte) (int, error)

func (*String) MarshalToSizedBuffer

func (a *String) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*String) ProtoMessage

func (*String) ProtoMessage()

func (String) Ptr

func (a String) Ptr() *string

Ptr returns a pointer to this String's value, or a nil pointer if this String is null.

func (*String) Reset

func (a *String) Reset()

func (*String) Scan

func (a *String) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >2x times faster than database/sql.convertAssign.

func (String) SetNull

func (a String) SetNull() String

SetNull sets the value to Go's default value and Valid to false.

func (String) SetValid

func (a String) SetValid(v string) String

SetValid changes this String's value and also sets it to be non-null.

func (String) Size

func (a String) Size() (n int)

func (String) String

func (a String) String() string

GoString prints an optimized Go representation.

func (*String) Unmarshal

func (a *String) Unmarshal(dAtA []byte) error

func (*String) UnmarshalBinary

func (a *String) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*String) UnmarshalJSON

func (a *String) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports string and null input. Blank string input does not produce a null String. It also supports unmarshalling a sql.String.

func (*String) UnmarshalText

func (a *String) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null String if the input is a blank string.

func (String) Value

func (a String) Value() (driver.Value, error)

Value implements the driver Valuer interface.

func (String) WriteTo

func (a String) WriteTo(d Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*String) XXX_DiscardUnknown

func (a *String) XXX_DiscardUnknown()

func (*String) XXX_Marshal

func (a *String) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*String) XXX_Merge

func (a *String) XXX_Merge(src proto.Message)

func (*String) XXX_Size

func (a *String) XXX_Size() int

func (*String) XXX_Unmarshal

func (a *String) XXX_Unmarshal(b []byte) error

type Time

type Time struct {
	sql.NullTime
}

Time represents a time.Time that may be NULL. Time implements the Scanner interface so it can be used as a scan destination:

var nt Time
err := db.QueryRow("SELECT time FROM foo WHERE id=?", id).Scan(&nt)
...
if nt.Valid {
   // use nt.Time
} else {
   // NULL value
}

This Time implementation is not driver-specific

func MakeTime

func MakeTime(t time.Time) Time

MakeTime creates a new Time. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Time implements interface Argument.

func MakeTimePtr

func MakeTimePtr(t time.Time) *Time

MakeTimePtr creates a new Time. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Time implements interface Argument.

func ParseDateTime

func ParseDateTime(str string, loc *time.Location) (t Time, err error)

ParseDateTime parses a string into a Time type. Empty string is considered NULL.

func (Time) Append

func (a Time) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Time) Descriptor

func (*Time) Descriptor() ([]byte, []int)

func (Time) GoString

func (a Time) GoString() string

GoString prints an optimized Go representation.

func (*Time) Marshal

func (a *Time) Marshal() (dAtA []byte, err error)

func (Time) MarshalBinary

func (a Time) MarshalBinary() (data []byte, err error)

MarshalBinary transforms the time type into a byte slice.

func (Time) MarshalJSON

func (a Time) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this time is null.

func (Time) MarshalText

func (a Time) MarshalText() ([]byte, error)

MarshalText transforms the time type into a byte slice.

func (*Time) MarshalTo

func (a *Time) MarshalTo(dAtA []byte) (int, error)

func (*Time) MarshalToSizedBuffer

func (a *Time) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Time) ProtoMessage

func (*Time) ProtoMessage()

func (Time) Ptr

func (a Time) Ptr() *time.Time

Ptr returns a pointer to this Time's value, or a nil pointer if this Time is null.

func (*Time) Reset

func (a *Time) Reset()

func (*Time) Scan

func (a *Time) Scan(value interface{}) (err error)

Scan implements the Scanner interface. The value type must be time.Time or string / []byte (formatted time-string), otherwise Scan fails. It supports more input data than database/sql.NullTime.Scan

func (Time) SetNull

func (a Time) SetNull() Time

SetNull sets the value to Go's default value and Valid to false.

func (Time) SetValid

func (a Time) SetValid(v time.Time) Time

SetValid changes this Time's value and sets it to be non-null.

func (Time) Size

func (a Time) Size() (n int)

func (Time) String

func (a Time) String() string

String returns the string representation of the time or null.

func (*Time) Unmarshal

func (a *Time) Unmarshal(dAtA []byte) error

func (*Time) UnmarshalBinary

func (a *Time) UnmarshalBinary(data []byte) error

UnmarshalBinary parses the byte slice to create a time type.

func (*Time) UnmarshalJSON

func (a *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports string, object (e.g. pq.Time and friends) and null input.

func (*Time) UnmarshalText

func (a *Time) UnmarshalText(text []byte) error

UnmarshalText parses the byte slice to create a time type.

func (Time) WriteTo

func (a Time) WriteTo(d Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Time) XXX_DiscardUnknown

func (a *Time) XXX_DiscardUnknown()

func (*Time) XXX_Marshal

func (a *Time) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Time) XXX_Merge

func (a *Time) XXX_Merge(src proto.Message)

func (*Time) XXX_Size

func (a *Time) XXX_Size() int

func (*Time) XXX_Unmarshal

func (a *Time) XXX_Unmarshal(b []byte) error

type Uint16

type Uint16 struct {
	Uint16 uint16
	Valid  bool // Valid is true if Uint16 is not NULL
}

Uint16 is a nullable int16. It does not consider zero values to be null. It will decode to null, not zero, if null. Uint16 implements interface Argument.

func MakeUint16

func MakeUint16(i uint16) Uint16

MakeUint16 creates a new Uint16. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Uint16 implements interface Argument.

func MakeUint16FromByte

func MakeUint16FromByte(data []byte) (nv Uint16, err error)

MakeUint16FromByte makes a new Uint16 from a (text) byte slice.

func MakeUint16Ptr

func MakeUint16Ptr(i uint16) *Uint16

MakeUint16Ptr creates a new Uint16. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Uint16 implements interface Argument.

func (Uint16) Append

func (a Uint16) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Uint16) Descriptor

func (*Uint16) Descriptor() ([]byte, []int)

func (Uint16) GoString

func (a Uint16) GoString() string

GoString prints an optimized Go representation. Takes are of backticks.

func (Uint16) IsZero

func (a Uint16) IsZero() bool

IsZero returns true for invalid Uint16's, for future omitempty support (Go 1.4?) A non-null Uint16 with a 0 value will not be considered zero.

func (*Uint16) Marshal

func (m *Uint16) Marshal() (dAtA []byte, err error)

func (Uint16) MarshalBinary

func (a Uint16) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Uint16) MarshalJSON

func (a Uint16) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Uint16 is null.

func (Uint16) MarshalText

func (a Uint16) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Uint16 is null.

func (*Uint16) MarshalTo

func (m *Uint16) MarshalTo(dAtA []byte) (int, error)

func (*Uint16) MarshalToSizedBuffer

func (m *Uint16) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Uint16) ProtoMessage

func (*Uint16) ProtoMessage()

func (Uint16) Ptr

func (a Uint16) Ptr() *uint16

Ptr returns a pointer to this Uint16's value, or a nil pointer if this Uint16 is null.

func (*Uint16) Reset

func (m *Uint16) Reset()

func (*Uint16) Scan

func (a *Uint16) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >3x times faster than database/sql.convertAssign

func (Uint16) SetNull

func (a Uint16) SetNull() Uint16

SetNull sets the value to Go's default value and Valid to false.

func (Uint16) SetValid

func (a Uint16) SetValid(n uint16) Uint16

SetValid changes this Uint16's value and also sets it to be non-null.

func (Uint16) Size

func (m Uint16) Size() (n int)

func (Uint16) String

func (a Uint16) String() string

String returns the string representation of the int or null.

func (*Uint16) Unmarshal

func (m *Uint16) Unmarshal(dAtA []byte) error

func (*Uint16) UnmarshalBinary

func (a *Uint16) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Uint16) UnmarshalJSON

func (a *Uint16) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Uint16. It also supports unmarshalling a sql.Uint16.

func (*Uint16) UnmarshalText

func (a *Uint16) UnmarshalText(text []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Uint16 if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or sqlStrNullLC.

func (Uint16) Value

func (a Uint16) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

func (Uint16) WriteTo

func (a Uint16) WriteTo(_ Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Uint16) XXX_DiscardUnknown

func (m *Uint16) XXX_DiscardUnknown()

func (*Uint16) XXX_Marshal

func (m *Uint16) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Uint16) XXX_Merge

func (m *Uint16) XXX_Merge(src proto.Message)

func (*Uint16) XXX_Size

func (m *Uint16) XXX_Size() int

func (*Uint16) XXX_Unmarshal

func (m *Uint16) XXX_Unmarshal(b []byte) error

type Uint32

type Uint32 struct {
	Uint32 uint32
	Valid  bool // Valid is true if Uint32 is not NULL
}

Uint32 is a nullable int32. It does not consider zero values to be null. It will decode to null, not zero, if null. Uint32 implements interface Argument.

func MakeUint32

func MakeUint32(i uint32) Uint32

MakeUint32 creates a new Uint32. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Uint32 implements interface Argument.

func MakeUint32FromByte

func MakeUint32FromByte(data []byte) (nv Uint32, err error)

MakeUint32FromByte makes a new Uint32 from a (text) byte slice.

func MakeUint32Ptr

func MakeUint32Ptr(i uint32) *Uint32

MakeUint32Ptr creates a new Uint32. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Uint32 implements interface Argument.

func (Uint32) Append

func (a Uint32) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Uint32) Descriptor

func (*Uint32) Descriptor() ([]byte, []int)

func (Uint32) GoString

func (a Uint32) GoString() string

GoString prints an optimized Go representation. Takes are of backticks.

func (Uint32) IsZero

func (a Uint32) IsZero() bool

IsZero returns true for invalid Uint32's, for future omitempty support (Go 1.4?) A non-null Uint32 with a 0 value will not be considered zero.

func (*Uint32) Marshal

func (m *Uint32) Marshal() (dAtA []byte, err error)

func (Uint32) MarshalBinary

func (a Uint32) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Uint32) MarshalJSON

func (a Uint32) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Uint32 is null.

func (Uint32) MarshalText

func (a Uint32) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Uint32 is null.

func (*Uint32) MarshalTo

func (m *Uint32) MarshalTo(dAtA []byte) (int, error)

func (*Uint32) MarshalToSizedBuffer

func (m *Uint32) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Uint32) ProtoMessage

func (*Uint32) ProtoMessage()

func (Uint32) Ptr

func (a Uint32) Ptr() *uint32

Ptr returns a pointer to this Uint32's value, or a nil pointer if this Uint32 is null.

func (*Uint32) Reset

func (m *Uint32) Reset()

func (*Uint32) Scan

func (a *Uint32) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >3x times faster than database/sql.convertAssign

func (Uint32) SetNull

func (a Uint32) SetNull() Uint32

SetNull sets the value to Go's default value and Valid to false.

func (Uint32) SetValid

func (a Uint32) SetValid(n uint32) Uint32

SetValid changes this Uint32's value and also sets it to be non-null.

func (Uint32) Size

func (m Uint32) Size() (n int)

func (Uint32) String

func (a Uint32) String() string

String returns the string representation of the int or null.

func (*Uint32) Unmarshal

func (m *Uint32) Unmarshal(dAtA []byte) error

func (*Uint32) UnmarshalBinary

func (a *Uint32) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Uint32) UnmarshalJSON

func (a *Uint32) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Uint32. It also supports unmarshalling a sql.Uint32.

func (*Uint32) UnmarshalText

func (a *Uint32) UnmarshalText(text []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Uint32 if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or sqlStrNullLC.

func (Uint32) Value

func (a Uint32) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

func (Uint32) WriteTo

func (a Uint32) WriteTo(_ Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Uint32) XXX_DiscardUnknown

func (m *Uint32) XXX_DiscardUnknown()

func (*Uint32) XXX_Marshal

func (m *Uint32) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Uint32) XXX_Merge

func (m *Uint32) XXX_Merge(src proto.Message)

func (*Uint32) XXX_Size

func (m *Uint32) XXX_Size() int

func (*Uint32) XXX_Unmarshal

func (m *Uint32) XXX_Unmarshal(b []byte) error

type Uint64

type Uint64 struct {
	Uint64 uint64
	Valid  bool // Valid is true if Uint64 is not NULL
}

Uint64 is a nullable int64. It does not consider zero values to be null. It will decode to null, not zero, if null. Uint64 implements interface Argument.

func MakeUint64

func MakeUint64(i uint64) Uint64

MakeUint64 creates a new Uint64. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Uint64 implements interface Argument.

func MakeUint64FromByte

func MakeUint64FromByte(data []byte) (nv Uint64, err error)

MakeUint64FromByte makes a new Uint64 from a (text) byte slice.

func MakeUint64Ptr

func MakeUint64Ptr(i uint64) *Uint64

MakeUint64Ptr creates a new Uint64. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Uint64 implements interface Argument.

func (Uint64) Append

func (a Uint64) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Uint64) Descriptor

func (*Uint64) Descriptor() ([]byte, []int)

func (Uint64) GoString

func (a Uint64) GoString() string

GoString prints an optimized Go representation. Takes are of backticks.

func (Uint64) IsZero

func (a Uint64) IsZero() bool

IsZero returns true for invalid Uint64's, for future omitempty support (Go 1.4?) A non-null Uint64 with a 0 value will not be considered zero.

func (*Uint64) Marshal

func (m *Uint64) Marshal() (dAtA []byte, err error)

func (Uint64) MarshalBinary

func (a Uint64) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Uint64) MarshalJSON

func (a Uint64) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Uint64 is null.

func (Uint64) MarshalText

func (a Uint64) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Uint64 is null.

func (*Uint64) MarshalTo

func (m *Uint64) MarshalTo(dAtA []byte) (int, error)

func (*Uint64) MarshalToSizedBuffer

func (m *Uint64) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Uint64) ProtoMessage

func (*Uint64) ProtoMessage()

func (Uint64) Ptr

func (a Uint64) Ptr() *uint64

Ptr returns a pointer to this Uint64's value, or a nil pointer if this Uint64 is null.

func (*Uint64) Reset

func (m *Uint64) Reset()

func (*Uint64) Scan

func (a *Uint64) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >3x times faster than database/sql.convertAssign

func (Uint64) SetNull

func (a Uint64) SetNull() Uint64

SetNull sets the value to Go's default value and Valid to false.

func (Uint64) SetValid

func (a Uint64) SetValid(n uint64) Uint64

SetValid changes this Uint64's value and also sets it to be non-null.

func (Uint64) Size

func (m Uint64) Size() (n int)

func (Uint64) String

func (a Uint64) String() string

String returns the string representation of the int or null.

func (*Uint64) Unmarshal

func (m *Uint64) Unmarshal(dAtA []byte) error

func (*Uint64) UnmarshalBinary

func (a *Uint64) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Uint64) UnmarshalJSON

func (a *Uint64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Uint64. It also supports unmarshalling a sql.Uint64.

func (*Uint64) UnmarshalText

func (a *Uint64) UnmarshalText(text []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Uint64 if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or sqlStrNullLC.

func (Uint64) Value

func (a Uint64) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

func (Uint64) WriteTo

func (a Uint64) WriteTo(_ Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Uint64) XXX_DiscardUnknown

func (m *Uint64) XXX_DiscardUnknown()

func (*Uint64) XXX_Marshal

func (m *Uint64) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Uint64) XXX_Merge

func (m *Uint64) XXX_Merge(src proto.Message)

func (*Uint64) XXX_Size

func (m *Uint64) XXX_Size() int

func (*Uint64) XXX_Unmarshal

func (m *Uint64) XXX_Unmarshal(b []byte) error

type Uint8

type Uint8 struct {
	Uint8 uint8
	Valid bool // Valid is true if Uint8 is not NULL
}

Uint8 is a nullable int8. It does not consider zero values to be null. It will decode to null, not zero, if null. Uint8 implements interface Argument.

func MakeUint8

func MakeUint8(i uint8) Uint8

MakeUint8 creates a new Uint8. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Uint8 implements interface Argument.

func MakeUint8FromByte

func MakeUint8FromByte(data []byte) (nv Uint8, err error)

MakeUint8FromByte makes a new Uint8 from a (text) byte slice.

func MakeUint8Ptr

func MakeUint8Ptr(i uint8) *Uint8

MakeUint8Ptr creates a new Uint8. Setting the second optional argument to false, the string will not be valid anymore, hence NULL. Uint8 implements interface Argument.

func (Uint8) Append

func (a Uint8) Append(args []interface{}) []interface{}

Append appends the value or its nil type to the interface slice.

func (*Uint8) Descriptor

func (*Uint8) Descriptor() ([]byte, []int)

func (Uint8) GoString

func (a Uint8) GoString() string

GoString prints an optimized Go representation. Takes are of backticks.

func (Uint8) IsZero

func (a Uint8) IsZero() bool

IsZero returns true for invalid Uint8's, for future omitempty support (Go 1.4?) A non-null Uint8 with a 0 value will not be considered zero.

func (*Uint8) Marshal

func (a *Uint8) Marshal() (dAtA []byte, err error)

func (Uint8) MarshalBinary

func (a Uint8) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Uint8) MarshalJSON

func (a Uint8) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Uint8 is null.

func (Uint8) MarshalText

func (a Uint8) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Uint8 is null.

func (*Uint8) MarshalTo

func (a *Uint8) MarshalTo(dAtA []byte) (int, error)

func (*Uint8) MarshalToSizedBuffer

func (a *Uint8) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Uint8) ProtoMessage

func (*Uint8) ProtoMessage()

func (Uint8) Ptr

func (a Uint8) Ptr() *uint8

Ptr returns a pointer to this Uint8's value, or a nil pointer if this Uint8 is null.

func (*Uint8) Reset

func (a *Uint8) Reset()

func (*Uint8) Scan

func (a *Uint8) Scan(value interface{}) (err error)

Scan implements the Scanner interface. Approx. >3x times faster than database/sql.convertAssign

func (Uint8) SetNull

func (a Uint8) SetNull() Uint8

SetNull sets the value to Go's default value and Valid to false.

func (Uint8) SetValid

func (a Uint8) SetValid(n uint8) Uint8

SetValid changes this Uint8's value and also sets it to be non-null.

func (Uint8) Size

func (a Uint8) Size() (n int)

func (Uint8) String

func (a Uint8) String() string

String returns the string representation of the int or null.

func (*Uint8) Unmarshal

func (a *Uint8) Unmarshal(dAtA []byte) error

func (*Uint8) UnmarshalBinary

func (a *Uint8) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Uint8) UnmarshalJSON

func (a *Uint8) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Uint8. It also supports unmarshalling a sql.Uint8.

func (*Uint8) UnmarshalText

func (a *Uint8) UnmarshalText(text []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Uint8 if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or sqlStrNullLC.

func (Uint8) Value

func (a Uint8) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

func (Uint8) WriteTo

func (a Uint8) WriteTo(_ Dialecter, w *bytes.Buffer) (err error)

WriteTo uses a special dialect to encode the value and write it into w. w cannot be replaced by io.Writer and shall not be replaced by an interface because of inlining features of the compiler.

func (*Uint8) XXX_DiscardUnknown

func (a *Uint8) XXX_DiscardUnknown()

func (*Uint8) XXX_Marshal

func (a *Uint8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Uint8) XXX_Merge

func (a *Uint8) XXX_Merge(src proto.Message)

func (*Uint8) XXX_Size

func (a *Uint8) XXX_Size() int

func (*Uint8) XXX_Unmarshal

func (a *Uint8) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL