null

package module
v7.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: BSD-2-Clause Imports: 10 Imported by: 0

README

null-extended GoDoc Coverage

null-extended is a library with reasonable options for dealing with nullable SQL and JSON values

Types in null will only be considered null on null input, and will JSON encode to null.

All types implement sql.Scanner and driver.Valuer, so you can use this library in place of sql.NullXXX. All types also implement: encoding.TextMarshaler, encoding.TextUnmarshaler, json.Marshaler, json.Unmarshaler and sql.Scanner.


Install:

go get -u "gopkg.in/volatiletech/null.v6"

null package

import "gopkg.in/volatiletech/null.v6"

The following are all types supported in this package. All types will marshal to JSON null if Invalid or SQL source data is null.

null.JSON

Nullable []byte.

Will marshal to JSON null if Invalid. []byte{} input will not produce an Invalid JSON, but []byte(nil) will. This should be used for storing raw JSON in the database.

Also has null.JSON.Marshal and null.JSON.Unmarshal helpers to marshal and unmarshal foreign objects.

null.Bytes

Nullable []byte.

[]byte{} input will not produce an Invalid Bytes, but []byte(nil) will. This should be used for storing binary data (bytea in PSQL for example) in the database.

null.String

Nullable string.

null.Byte

Nullable byte.

null.Bool

Nullable bool.

null.Time

Nullable time.Time

Marshals to JSON null if SQL source data is null. Uses time.Time's marshaler.

null.Float32

Nullable float32.

null.Float64

Nullable float64.

null.Int

Nullable int.

null.Int8

Nullable int8.

null.Int16

Nullable int16.

null.Int32

Nullable int32.

null.Int64

Nullable int64.

null.Uint

Nullable uint.

null.Uint8

Nullable uint8.

null.Uint16

Nullable uint16.

null.Uint32

Nullable int32.

null.Int64

Nullable uint64.

Bugs

json's ",omitempty" struct tag does not work correctly right now. It will never omit a null or empty String. This might be fixed eventually.

License

BSD

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NullBytes = []byte("null")

NullBytes is a global byte slice of JSON null

Functions

This section is empty.

Types

type Bool

type Bool struct {
	Bool  bool
	Valid bool
}

Bool is a nullable bool.

func BoolFrom

func BoolFrom(b bool) Bool

BoolFrom creates a new Bool that will always be valid.

func BoolFromPtr

func BoolFromPtr(b *bool) Bool

BoolFromPtr creates a new Bool that will be null if f is nil.

func NewBool

func NewBool(b bool, valid bool) Bool

NewBool creates a new Bool

func (Bool) IsZero

func (b Bool) IsZero() bool

IsZero returns true for invalid Bools, for future omitempty support (Go 1.4?)

func (Bool) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Bool) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Bool) Ptr

func (b Bool) Ptr() *bool

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

func (*Bool) Randomize

func (b *Bool) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Bool) Scan

func (b *Bool) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Bool) SetValid

func (b *Bool) SetValid(v bool)

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

func (*Bool) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Bool) UnmarshalText

func (b *Bool) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Bool) Value

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

Value implements the driver Valuer interface.

type Byte

type Byte struct {
	Byte  byte
	Valid bool
}

Byte is an nullable int.

func ByteFrom

func ByteFrom(b byte) Byte

ByteFrom creates a new Byte that will always be valid.

func ByteFromPtr

func ByteFromPtr(b *byte) Byte

ByteFromPtr creates a new Byte that be null if i is nil.

func NewByte

func NewByte(b byte, valid bool) Byte

NewByte creates a new Byte

func (Byte) IsZero

func (b Byte) IsZero() bool

IsZero returns true for invalid Bytes, for future omitempty support (Go 1.4?)

func (Byte) MarshalJSON

func (b Byte) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Byte) MarshalText

func (b Byte) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Byte) Ptr

func (b Byte) Ptr() *byte

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

func (*Byte) Randomize

func (b *Byte) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Byte) Scan

func (b *Byte) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Byte) SetValid

func (b *Byte) SetValid(n byte)

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

func (*Byte) UnmarshalJSON

func (b *Byte) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Byte) UnmarshalText

func (b *Byte) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Byte) Value

func (b Byte) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Bytes

type Bytes struct {
	Bytes []byte
	Valid bool
}

Bytes is a nullable []byte.

func BytesFrom

func BytesFrom(b []byte) Bytes

BytesFrom creates a new Bytes that will be invalid if nil.

func BytesFromPtr

func BytesFromPtr(b *[]byte) Bytes

BytesFromPtr creates a new Bytes that will be invalid if nil.

func NewBytes

func NewBytes(b []byte, valid bool) Bytes

NewBytes creates a new Bytes

func (Bytes) IsZero

func (b Bytes) IsZero() bool

IsZero returns true for null or zero Bytes's, for future omitempty support (Go 1.4?)

func (Bytes) MarshalJSON

func (b Bytes) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Bytes) MarshalText

func (b Bytes) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Bytes) Ptr

func (b Bytes) Ptr() *[]byte

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

func (*Bytes) Randomize

func (b *Bytes) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Bytes) Scan

func (b *Bytes) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Bytes) SetValid

func (b *Bytes) SetValid(n []byte)

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

func (*Bytes) UnmarshalJSON

func (b *Bytes) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Bytes) UnmarshalText

func (b *Bytes) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Bytes) Value

func (b Bytes) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Float32

type Float32 struct {
	Float32 float32
	Valid   bool
}

Float32 is a nullable float32.

func Float32From

func Float32From(f float32) Float32

Float32From creates a new Float32 that will always be valid.

func Float32FromPtr

func Float32FromPtr(f *float32) Float32

Float32FromPtr creates a new Float32 that be null if f is nil.

func NewFloat32

func NewFloat32(f float32, valid bool) Float32

NewFloat32 creates a new Float32

func (Float32) IsZero

func (f Float32) IsZero() bool

IsZero returns true for invalid Float32s, for future omitempty support (Go 1.4?)

func (Float32) MarshalJSON

func (f Float32) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Float32) MarshalText

func (f Float32) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Float32) Ptr

func (f Float32) Ptr() *float32

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

func (*Float32) Randomize

func (f *Float32) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Float32) Scan

func (f *Float32) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Float32) SetValid

func (f *Float32) SetValid(n float32)

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

func (*Float32) UnmarshalJSON

func (f *Float32) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Float32) UnmarshalText

func (f *Float32) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Float32) Value

func (f Float32) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Float64

type Float64 struct {
	Float64 float64
	Valid   bool
}

Float64 is a nullable float64.

func Float64From

func Float64From(f float64) Float64

Float64From creates a new Float64 that will always be valid.

func Float64FromPtr

func Float64FromPtr(f *float64) Float64

Float64FromPtr creates a new Float64 that be null if f is nil.

func NewFloat64

func NewFloat64(f float64, valid bool) Float64

NewFloat64 creates a new Float64

func (Float64) IsZero

func (f Float64) IsZero() bool

IsZero returns true for invalid Float64s, for future omitempty support (Go 1.4?)

func (Float64) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Float64) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Float64) Ptr

func (f Float64) Ptr() *float64

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

func (*Float64) Randomize

func (f *Float64) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Float64) Scan

func (f *Float64) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Float64) SetValid

func (f *Float64) SetValid(n float64)

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

func (*Float64) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Float64) UnmarshalText

func (f *Float64) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Float64) Value

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

Value implements the driver Valuer interface.

type Int

type Int struct {
	Int   int
	Valid bool
}

Int is an nullable int.

func IntFrom

func IntFrom(i int) Int

IntFrom creates a new Int that will always be valid.

func IntFromPtr

func IntFromPtr(i *int) Int

IntFromPtr creates a new Int that be null if i is nil.

func NewInt

func NewInt(i int, valid bool) Int

NewInt creates a new Int

func (Int) IsZero

func (i Int) IsZero() bool

IsZero returns true for invalid Ints, for future omitempty support (Go 1.4?)

func (Int) MarshalJSON

func (i Int) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Int) MarshalText

func (i Int) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Int) Ptr

func (i Int) Ptr() *int

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

func (*Int) Randomize

func (i *Int) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Int) Scan

func (i *Int) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Int) SetValid

func (i *Int) SetValid(n int)

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

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Int) UnmarshalText

func (i *Int) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Int) Value

func (i Int) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Int16

type Int16 struct {
	Int16 int16
	Valid bool
}

Int16 is an nullable int16.

func Int16From

func Int16From(i int16) Int16

Int16From creates a new Int16 that will always be valid.

func Int16FromPtr

func Int16FromPtr(i *int16) Int16

Int16FromPtr creates a new Int16 that be null if i is nil.

func NewInt16

func NewInt16(i int16, valid bool) Int16

NewInt16 creates a new Int16

func (Int16) IsZero

func (i Int16) IsZero() bool

IsZero returns true for invalid Int16's, for future omitempty support (Go 1.4?)

func (Int16) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Int16) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Int16) Ptr

func (i Int16) Ptr() *int16

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

func (*Int16) Randomize

func (i *Int16) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Int16) Scan

func (i *Int16) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Int16) SetValid

func (i *Int16) SetValid(n int16)

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

func (*Int16) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Int16) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (Int16) Value

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

Value implements the driver Valuer interface.

type Int32

type Int32 struct {
	Int32 int32
	Valid bool
}

Int32 is an nullable int32.

func Int32From

func Int32From(i int32) Int32

Int32From creates a new Int32 that will always be valid.

func Int32FromPtr

func Int32FromPtr(i *int32) Int32

Int32FromPtr creates a new Int32 that be null if i is nil.

func NewInt32

func NewInt32(i int32, valid bool) Int32

NewInt32 creates a new Int32

func (Int32) IsZero

func (i Int32) IsZero() bool

IsZero returns true for invalid Int32's, for future omitempty support (Go 1.4?)

func (Int32) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Int32) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Int32) Ptr

func (i Int32) Ptr() *int32

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

func (*Int32) Randomize

func (i *Int32) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Int32) Scan

func (i *Int32) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Int32) SetValid

func (i *Int32) SetValid(n int32)

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

func (*Int32) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Int32) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (Int32) Value

func (i Int32) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Int64

type Int64 struct {
	Int64 int64
	Valid bool
}

Int64 is an nullable int64.

func Int64From

func Int64From(i int64) Int64

Int64From creates a new Int64 that will always be valid.

func Int64FromPtr

func Int64FromPtr(i *int64) Int64

Int64FromPtr creates a new Int64 that be null if i is nil.

func NewInt64

func NewInt64(i int64, valid bool) Int64

NewInt64 creates a new Int64

func (Int64) IsZero

func (i Int64) IsZero() bool

IsZero returns true for invalid Int64's, for future omitempty support (Go 1.4?)

func (Int64) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Int64) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Int64) Ptr

func (i Int64) Ptr() *int64

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

func (*Int64) Randomize

func (i *Int64) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Int64) Scan

func (i *Int64) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Int64) SetValid

func (i *Int64) SetValid(n int64)

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

func (*Int64) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Int64) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (Int64) Value

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

Value implements the driver Valuer interface.

type Int8

type Int8 struct {
	Int8  int8
	Valid bool
}

Int8 is an nullable int8.

func Int8From

func Int8From(i int8) Int8

Int8From creates a new Int8 that will always be valid.

func Int8FromPtr

func Int8FromPtr(i *int8) Int8

Int8FromPtr creates a new Int8 that be null if i is nil.

func NewInt8

func NewInt8(i int8, valid bool) Int8

NewInt8 creates a new Int8

func (Int8) IsZero

func (i Int8) IsZero() bool

IsZero returns true for invalid Int8's, for future omitempty support (Go 1.4?)

func (Int8) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Int8) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Int8) Ptr

func (i Int8) Ptr() *int8

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

func (*Int8) Randomize

func (i *Int8) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Int8) Scan

func (i *Int8) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Int8) SetValid

func (i *Int8) SetValid(n int8)

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

func (*Int8) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Int8) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (Int8) Value

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

Value implements the driver Valuer interface.

type JSON

type JSON struct {
	JSON  []byte
	Valid bool
}

JSON is a nullable []byte.

func JSONFrom

func JSONFrom(b []byte) JSON

JSONFrom creates a new JSON that will be invalid if nil.

func JSONFromPtr

func JSONFromPtr(b *[]byte) JSON

JSONFromPtr creates a new JSON that will be invalid if nil.

func NewJSON

func NewJSON(b []byte, valid bool) JSON

NewJSON creates a new JSON

func (JSON) IsZero

func (j JSON) IsZero() bool

IsZero returns true for null or zero JSON's, for future omitempty support (Go 1.4?)

func (*JSON) Marshal

func (j *JSON) Marshal(obj interface{}) error

Marshal will marshal the passed in object, and store it in the JSON member on the JSON object.

func (JSON) MarshalJSON

func (j JSON) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (JSON) MarshalText

func (j JSON) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (JSON) Ptr

func (j JSON) Ptr() *[]byte

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

func (*JSON) Randomize

func (j *JSON) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*JSON) Scan

func (j *JSON) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*JSON) SetValid

func (j *JSON) SetValid(n []byte)

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

func (JSON) Unmarshal

func (j JSON) Unmarshal(dest interface{}) error

Unmarshal will unmarshal your JSON stored in your JSON object and store the result in the value pointed to by dest.

func (*JSON) UnmarshalJSON

func (j *JSON) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*JSON) UnmarshalText

func (j *JSON) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (JSON) Value

func (j JSON) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type String

type String struct {
	String string
	Valid  bool
}

String is a nullable string. It supports SQL and JSON serialization.

func NewString

func NewString(s string, valid bool) String

NewString creates a new String

func StringFrom

func StringFrom(s string) String

StringFrom creates a new String that will never be blank.

func StringFromPtr

func StringFromPtr(s *string) String

StringFromPtr creates a new String that be null if s is nil.

func (String) IsZero

func (s String) IsZero() bool

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

func (String) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (String) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (String) Ptr

func (s String) Ptr() *string

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

func (*String) Randomize

func (s *String) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*String) Scan

func (s *String) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*String) SetValid

func (s *String) SetValid(v string)

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

func (*String) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*String) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (String) Value

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

Value implements the driver Valuer interface.

type Time

type Time struct {
	Time  time.Time
	Valid bool
}

Time is a nullable time.Time. It supports SQL and JSON serialization.

func NewTime

func NewTime(t time.Time, valid bool) Time

NewTime creates a new Time.

func TimeFrom

func TimeFrom(t time.Time) Time

TimeFrom creates a new Time that will always be valid.

func TimeFromPtr

func TimeFromPtr(t *time.Time) Time

TimeFromPtr creates a new Time that will be null if t is nil.

func (Time) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Time) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Time) Ptr

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

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

func (*Time) Randomize

func (t *Time) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Time) Scan

func (t *Time) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Time) SetValid

func (t *Time) SetValid(v time.Time)

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

func (*Time) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Time) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Uint

type Uint struct {
	Uint  uint
	Valid bool
}

Uint is an nullable uint.

func NewUint

func NewUint(i uint, valid bool) Uint

NewUint creates a new Uint

func UintFrom

func UintFrom(i uint) Uint

UintFrom creates a new Uint that will always be valid.

func UintFromPtr

func UintFromPtr(i *uint) Uint

UintFromPtr creates a new Uint that be null if i is nil.

func (Uint) IsZero

func (u Uint) IsZero() bool

IsZero returns true for invalid Uints, for future omitempty support (Go 1.4?)

func (Uint) MarshalJSON

func (u Uint) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Uint) MarshalText

func (u Uint) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Uint) Ptr

func (u Uint) Ptr() *uint

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

func (*Uint) Randomize

func (u *Uint) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Uint) Scan

func (u *Uint) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Uint) SetValid

func (u *Uint) SetValid(n uint)

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

func (*Uint) UnmarshalJSON

func (u *Uint) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Uint) UnmarshalText

func (u *Uint) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Uint) Value

func (u Uint) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Uint16

type Uint16 struct {
	Uint16 uint16
	Valid  bool
}

Uint16 is an nullable uint16.

func NewUint16

func NewUint16(i uint16, valid bool) Uint16

NewUint16 creates a new Uint16

func Uint16From

func Uint16From(i uint16) Uint16

Uint16From creates a new Uint16 that will always be valid.

func Uint16FromPtr

func Uint16FromPtr(i *uint16) Uint16

Uint16FromPtr creates a new Uint16 that be null if i is nil.

func (Uint16) IsZero

func (u Uint16) IsZero() bool

IsZero returns true for invalid Uint16's, for future omitempty support (Go 1.4?)

func (Uint16) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Uint16) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Uint16) Ptr

func (u Uint16) Ptr() *uint16

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

func (*Uint16) Randomize

func (u *Uint16) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Uint16) Scan

func (u *Uint16) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Uint16) SetValid

func (u *Uint16) SetValid(n uint16)

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

func (*Uint16) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Uint16) UnmarshalText

func (u *Uint16) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Uint16) Value

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

Value implements the driver Valuer interface.

type Uint32

type Uint32 struct {
	Uint32 uint32
	Valid  bool
}

Uint32 is an nullable uint32.

func NewUint32

func NewUint32(i uint32, valid bool) Uint32

NewUint32 creates a new Uint32

func Uint32From

func Uint32From(i uint32) Uint32

Uint32From creates a new Uint32 that will always be valid.

func Uint32FromPtr

func Uint32FromPtr(i *uint32) Uint32

Uint32FromPtr creates a new Uint32 that be null if i is nil.

func (Uint32) IsZero

func (u Uint32) IsZero() bool

IsZero returns true for invalid Uint32's, for future omitempty support (Go 1.4?)

func (Uint32) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Uint32) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Uint32) Ptr

func (u Uint32) Ptr() *uint32

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

func (*Uint32) Randomize

func (u *Uint32) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Uint32) Scan

func (u *Uint32) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Uint32) SetValid

func (u *Uint32) SetValid(n uint32)

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

func (*Uint32) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Uint32) UnmarshalText

func (u *Uint32) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Uint32) Value

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

Value implements the driver Valuer interface.

type Uint64

type Uint64 struct {
	Uint64 uint64
	Valid  bool
}

Uint64 is an nullable uint64.

func NewUint64

func NewUint64(i uint64, valid bool) Uint64

NewUint64 creates a new Uint64

func Uint64From

func Uint64From(i uint64) Uint64

Uint64From creates a new Uint64 that will always be valid.

func Uint64FromPtr

func Uint64FromPtr(i *uint64) Uint64

Uint64FromPtr creates a new Uint64 that be null if i is nil.

func (Uint64) IsZero

func (u Uint64) IsZero() bool

IsZero returns true for invalid Uint64's, for future omitempty support (Go 1.4?)

func (Uint64) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Uint64) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Uint64) Ptr

func (u Uint64) Ptr() *uint64

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

func (*Uint64) Randomize

func (u *Uint64) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Uint64) Scan

func (u *Uint64) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Uint64) SetValid

func (u *Uint64) SetValid(n uint64)

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

func (*Uint64) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Uint64) UnmarshalText

func (u *Uint64) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Uint64) Value

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

Value implements the driver Valuer interface.

type Uint8

type Uint8 struct {
	Uint8 uint8
	Valid bool
}

Uint8 is an nullable uint8.

func NewUint8

func NewUint8(i uint8, valid bool) Uint8

NewUint8 creates a new Uint8

func Uint8From

func Uint8From(i uint8) Uint8

Uint8From creates a new Uint8 that will always be valid.

func Uint8FromPtr

func Uint8FromPtr(i *uint8) Uint8

Uint8FromPtr creates a new Uint8 that be null if i is nil.

func (Uint8) IsZero

func (u Uint8) IsZero() bool

IsZero returns true for invalid Uint8's, for future omitempty support (Go 1.4?)

func (Uint8) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Uint8) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (Uint8) Ptr

func (u Uint8) Ptr() *uint8

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

func (*Uint8) Randomize

func (u *Uint8) Randomize(seed *randomize.Seed, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Uint8) Scan

func (u *Uint8) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Uint8) SetValid

func (u *Uint8) SetValid(n uint8)

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

func (*Uint8) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Uint8) UnmarshalText

func (u *Uint8) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Uint8) Value

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

Value implements the driver Valuer interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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