null

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package null provides some clean helpers for sql NULL value handling

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b interface{}) sql.NullBool

Bool safely converts b to a sql.NullBool

func Int64

func Int64(i interface{}) sql.NullInt64

Int64 safely converts i to a sql.NullInt64

func JSON

func JSON(j interface{}) types.NullJSONText

JSON safely convers or marshals to a sql.NullJSONText Failure to marshal results in an error object

func String

func String(s interface{}) sql.NullString

String safely converts s to a sql.NullString

func Time

func Time(tm interface{}) sql.NullTime

Time safely converts tm to a sql.NullTime

Types

type Timer

type Timer interface {
	Time() time.Time
}

Timer is time interface

type UUID

type UUID struct {
	UUID  uuid.UUID
	Valid bool // Valid is true if UUID is not NULL
}

UUID represents a uuid that may be null.

func MakeUUID

func MakeUUID(u interface{}) UUID

MakeUUID safely converts s to a null.UUID

func (*UUID) Scan

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

Scan implements the Scanner interface.

func (UUID) Value

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

Value implements the driver Valuer interface.

Jump to

Keyboard shortcuts

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