nulls

package
v4.11.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: MIT Imports: 3 Imported by: 0

README

github.com/gobuffalo/pop/nulls

DEPRECATED: use github.com/gobuffalo/nulls instead.

This package should be used in place of the built-in null types in the sql package.

The real benefit of this packages comes in its implementation of MarshalJSON and UnmarshalJSON to properly encode/decode null values.

Installation

$ go get github.com/gobuffalo/pop/nulls

Supported Datatypes

  • string (nulls.String) - Replaces sql.NullString
  • int64 (nulls.Int64) - Replaces sql.NullInt64
  • float64 (nulls.Float64) - Replaces sql.NullFloat64
  • bool (nulls.Bool) - Replaces sql.NullBool
  • []byte (nulls.ByteSlice)
  • float32 (nulls.Float32)
  • int (nulls.Int)
  • int32 (nulls.Int32)
  • uint32 (nulls.UInt32)
  • time.Time (nulls.Time)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewBool = nulls.NewBool

NewBool returns a new, properly instantiated Bool object.

Deprecated: use github.com/gobuffalo/nulls#NewBool instead.

View Source
var NewByteSlice = nulls.NewByteSlice

NewByteSlice returns a new, properly instantiated ByteSlice object.

Deprecated: use github.com/gobuffalo/nulls#NewByteSlice instead.

View Source
var NewFloat32 = nulls.NewFloat32

NewFloat32 returns a new, properly instantiated Float32 object.

Deprecated: use github.com/gobuffalo/nulls#NewFloat32 instead.

View Source
var NewFloat64 = nulls.NewFloat64

NewFloat64 returns a new, properly instantiated Float64 object.

Deprecated: use github.com/gobuffalo/nulls#NewFloat64 instead.

View Source
var NewInt = nulls.NewInt

NewInt returns a new, properly instantiated Int object.

Deprecated: use github.com/gobuffalo/nulls#NewInt instead.

View Source
var NewInt32 = nulls.NewInt32

NewInt32 returns a new, properly instantiated Int object.

Deprecated: use github.com/gobuffalo/nulls#NewInt32 instead.

View Source
var NewInt64 = nulls.NewInt64

NewInt64 returns a new, properly instantiated Int64 object.

Deprecated: use github.com/gobuffalo/nulls#NewInt64 instead.

View Source
var NewString = nulls.NewString

NewString returns a new, properly instantiated String object.

Deprecated: use github.com/gobuffalo/nulls#NewString instead.

View Source
var NewTime = nulls.NewTime

NewTime returns a new, properly instantiated Time object.

Deprecated: use github.com/gobuffalo/nulls#NewTime instead.

View Source
var NewUInt32 = nulls.NewUInt32

NewUInt32 returns a new, properly instantiated Int object.

Deprecated: use github.com/gobuffalo/nulls#NewUInt32 instead.

View Source
var NewUUID = nulls.NewUUID

NewUUID returns a new, properly instantiated UUID object.

Deprecated: use github.com/gobuffalo/nulls#NewUUID instead.

View Source
var RegisterWithSchema = nulls.RegisterWithSchema

RegisterWithSchema allows for the nulls package to be used with http://www.gorillatoolkit.org/pkg/schema#Converter

Functions

This section is empty.

Types

type Bool deprecated

type Bool = nulls.Bool

Bool replaces sql.NullBool with an implementation that supports proper JSON encoding/decoding.

Deprecated: use github.com/gobuffalo/nulls#Bool instead.

type ByteSlice deprecated

type ByteSlice = nulls.ByteSlice

ByteSlice adds an implementation for []byte that supports proper JSON encoding/decoding.

Deprecated: use github.com/gobuffalo/nulls#ByteSlice instead.

type Float32 deprecated

type Float32 = nulls.Float32

Float32 adds an implementation for float32 that supports proper JSON encoding/decoding.

Deprecated: use github.com/gobuffalo/nulls#Float32 instead.

type Float64 deprecated

type Float64 = nulls.Float64

Float64 replaces sql.NullFloat64 with an implementation that supports proper JSON encoding/decoding.

Deprecated: use github.com/gobuffalo/nulls#Float64 instead.

type Int deprecated

type Int = nulls.Int

Int adds an implementation for int that supports proper JSON encoding/decoding.

Deprecated: use github.com/gobuffalo/nulls#Int instead.

type Int32 deprecated

type Int32 = nulls.Int32

Int32 adds an implementation for int32 that supports proper JSON encoding/decoding.

Deprecated: use github.com/gobuffalo/nulls#Int32 instead.

type Int64 deprecated

type Int64 = nulls.Int64

Int64 replaces sql.Int64 with an implementation that supports proper JSON encoding/decoding.

Deprecated: use github.com/gobuffalo/nulls#Int64 instead.

type Nulls

type Nulls struct {
	Value interface{}
}

Nulls a generic nulls type. something that implements nullable interface. can be any of nulls.Int, nulls.uuid.UUID nulls.String, etc.

func New

func New(i interface{}) *Nulls

New returns a wrapper called nulls for the interface passed as a param.

func (*Nulls) Interface

func (nulls *Nulls) Interface() interface{}

Interface calls Interface function for value.

func (*Nulls) Parse

func (nulls *Nulls) Parse(value interface{}) interface{}

Parse parses the specified value to the corresponding nullable type. value is one of the inner value hold by a nullable type. i.e int, string, uuid.UUID etc.

type String deprecated

type String = nulls.String

String replaces sql.NullString with an implementation that supports proper JSON encoding/decoding.

Deprecated: use github.com/gobuffalo/nulls#String instead.

type Time deprecated

type Time = nulls.Time

Time replaces sql.NullTime with an implementation that supports proper JSON encoding/decoding.

Deprecated: use github.com/gobuffalo/nulls#Time instead.

type UInt32 deprecated

type UInt32 = nulls.UInt32

UInt32 adds an implementation for int that supports proper JSON encoding/decoding.

Deprecated: use github.com/gobuffalo/nulls#UInt32 instead.

type UUID deprecated

type UUID = nulls.UUID

UUID can be used with the standard sql package to represent a UUID value that can be NULL in the database

Deprecated: use github.com/gobuffalo/nulls#UUID instead.

Jump to

Keyboard shortcuts

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