Skip to content

A collection of functions in go language for handle null when json encode and json decode with database/sql package.

License

Notifications You must be signed in to change notification settings

MrAndreID/gonull

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MrAndreID / Go Null

Go Reference License: MIT

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/.

About

A collection of functions in go language for handle null when json encode and json decode with database/sql package.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages