gotypes

package module
v0.0.0-...-be28b34 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: Unlicense Imports: 2 Imported by: 0

README

gotypes

Some simple types based on builtin Golang types that implement interfaces for working with DB (Scan / Value) and JSON (Marshal / Unmarshal).

NullUint

Simplified sql.NullInt64 (but unsigned): not struct, based on builtin uint type.

ni := sql.NullInt64{Int64: 32, Valid: true}
// Corresponds to
nu := gotypes.NullUint(32)

ni := sql.NullInt64{Int64: 0, Valid: true}
// Corresponds to
nu := gotypes.NullUint(0)

ni := sql.NullInt64{Int64: 32, Valid: false}
// Corresponds to
nu := gotypes.NullUint(0)

NullString

Simplified sql.NullString: not struct, based on builtin string type.

ni := sql.NullString{String: "example", Valid: true}
// Corresponds to
nu := gotypes.NullString("example")

ni := sql.NullInt64{String: "", Valid: true}
// Corresponds to
nu := gotypes.NullString("")

ni := sql.NullInt64{String: "example", Valid: false}
// Corresponds to
nu := gotypes.NullString("")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NullString

type NullString string

NullString string. Empty value ” corresponds to db-value NULL. Строка. Пустое значение ” соответствует значению NULL в БД.

func (*NullString) Scan

func (ns *NullString) Scan(src interface{}) error

func (NullString) Value

func (ns NullString) Value() (driver.Value, error)

type NullUint

type NullUint uint

NullUint unsigned integer. Value 0 corresponds to db-value NULL. Беззнаковое целое. Значение 0 соответствует значению NULL в БД.

func (*NullUint) Scan

func (nu *NullUint) Scan(src interface{}) error

func (NullUint) Value

func (nu NullUint) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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