gonull

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: MIT Imports: 3 Imported by: 0

README

MrAndreID / Go Null

Go Reference

The MrAndreID/GoNull package is a collection of functions in the go language for handle null when json encode and json decode with database/sql package.


Table of Contents


Install

To use The MrAndreID/GoNull package, you must follow the steps below:

go get -u github.com/MrAndreID/gonull

Usage

To use The MrAndreID/GoNull package, you must combine it with The database/sql package.

Null String
import "database/sql"

name := gonull.NullString{sql.NullString{"Andrea Adam", true}}
Null Int32
import "database/sql"

row := gonull.NullInt32{sql.NullInt32{1, true}}
Null Int64
import "database/sql"

row := gonull.NullInt64{sql.NullInt64{int64(1), true}}
Null Bool
import "database/sql"

active := gonull.NullBool{sql.NullBool{true, true}}
Null Time
import (
    "time"
	"database/sql"
)

date, _ := time.Parse("2006-01-02 15:04:05", time.Now().Local().Format("2006-01-02 15:04:05"))
createdAt = gonull.NullTime{sql.NullTime{date, true}}

Versioning

I use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

Andrea Adam - MrAndreID

License

MIT licensed. See the LICENSE file for details.

Official Documentation for Go Language

Documentation for Go Language can be found on the Go Language website.

More

Documentation can be found on https://go.dev/.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NullBool

type NullBool struct {
	sql.NullBool
}

func (NullBool) MarshalJSON

func (response NullBool) MarshalJSON() ([]byte, error)

func (*NullBool) UnmarshalJSON

func (response *NullBool) UnmarshalJSON(data []byte) error

type NullInt32

type NullInt32 struct {
	sql.NullInt32
}

func (NullInt32) MarshalJSON

func (response NullInt32) MarshalJSON() ([]byte, error)

func (*NullInt32) UnmarshalJSON

func (response *NullInt32) UnmarshalJSON(data []byte) error

type NullInt64

type NullInt64 struct {
	sql.NullInt64
}

func (NullInt64) MarshalJSON

func (response NullInt64) MarshalJSON() ([]byte, error)

func (*NullInt64) UnmarshalJSON

func (response *NullInt64) UnmarshalJSON(data []byte) error

type NullString

type NullString struct {
	sql.NullString
}

func (NullString) MarshalJSON

func (response NullString) MarshalJSON() ([]byte, error)

func (*NullString) UnmarshalJSON

func (response *NullString) UnmarshalJSON(data []byte) error

type NullTime

type NullTime struct {
	sql.NullTime
}

func (NullTime) MarshalJSON

func (response NullTime) MarshalJSON() ([]byte, error)

func (*NullTime) UnmarshalJSON

func (response *NullTime) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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