nulls

package
v4.11.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 5, 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.

View Source
var NewByteSlice = nulls.NewByteSlice

NewByteSlice returns a new, properly instantiated ByteSlice object.

View Source
var NewFloat32 = nulls.NewFloat32

NewFloat32 returns a new, properly instantiated Float32 object.

View Source
var NewFloat64 = nulls.NewFloat64

NewFloat64 returns a new, properly instantiated Float64 object.

View Source
var NewInt = nulls.NewInt

NewInt returns a new, properly instantiated Int object.

View Source
var NewInt32 = nulls.NewInt32

NewInt32 returns a new, properly instantiated Int object.

View Source
var NewInt64 = nulls.NewInt64

NewInt64 returns a new, properly instantiated Int64 object.

View Source
var NewString = nulls.NewString

NewString returns a new, properly instantiated String object.

View Source
var NewTime = nulls.NewTime

NewTime returns a new, properly instantiated Time object.

View Source
var NewUInt32 = nulls.NewUInt32

NewUInt32 returns a new, properly instantiated Int object.

View Source
var NewUUID = nulls.NewUUID

NewUUID returns a new, properly instantiated UUID object.

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

type Bool nulls.Bool

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

type ByteSlice

type ByteSlice nulls.ByteSlice

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

type Float32

type Float32 nulls.Float32

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

type Float64

type Float64 nulls.Float64

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

type Int

type Int nulls.Int

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

type Int32

type Int32 nulls.Int32

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

type Int64

type Int64 nulls.Int64

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

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

type String nulls.String

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

type Time

type Time nulls.Time

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

type UInt32

type UInt32 nulls.UInt32

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

type UUID

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

Jump to

Keyboard shortcuts

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