null is a library with reasonable options for dealing with nullable SQL and JSON values. There are two packages: null and its subpackage zero. Types in null will only be considered null on null input, and will JSON encode to null. If you need zero and null be considered separate values, use these. Types in zero are treated like zero values in Go: blank string input will produce a null zero.String, and null Strings will JSON encode to "". Zero values of these types will be considered null to SQL. If you need zero and null treated the same, use these. All types implement sql.Scanner and driver.Valuer, so you can use this library in place of sql.NullXXX. All types also implement: encoding.TextMarshaler, encoding.TextUnmarshaler, json.Marshaler, and json.Unmarshaler. A null object's MarshalText will return a blank string.

Features

  • It will only support the types that driver.Value supports
  • This package isn't intended to be a catch-all data-wrangling package
  • Marshals to JSON null if SQL source data is null. Zero input will not produce a null Int.
  • There are two packages: null and its subpackage zero
  • Types in zero are treated like zero values in Go
  • null is a library with reasonable options for dealing with nullable SQL and JSON values

Project Samples

Project Activity

See All Activity >

Categories

Frameworks

License

BSD License

Follow null

null Web Site

Other Useful Business Software
No-Nonsense Code-to-Cloud Security for Devs | Aikido Icon
No-Nonsense Code-to-Cloud Security for Devs | Aikido

Connect your GitHub, GitLab, Bitbucket or Azure DevOps account to start scanning your repos for free.

Aikido provides a unified security platform for developers, combining 12 powerful scans like SAST, DAST, and CSPM. AI-driven AutoFix and AutoTriage streamline vulnerability management, while runtime protection blocks attacks.
Learn More
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of null!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

Go

Related Categories

Go Frameworks

Registered

2023-01-30