# guregu/null

reasonable handling of nullable values

Repository: https://github.com/guregu/null
Canonical: https://ross.abutalabs.com/products/null
Language: Go
License: BSD-2-Clause
License Family: permissive
Topics: go, sql, json
Last push: 2025-03-05T18:44:45+00:00

## Health v2 (maintenance only)
Score: 27/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 9, release rhythm 8, longevity 100
- inputs: {"age_days": 4388, "days_push": 546, "days_rel": 546, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2070, forks 247 (observed 2026-08-28T04:06:10.392764+00:00)

## What it is
A Go library providing nullable types for SQL and JSON values, with two packages: null (null and zero are distinct) and zero (null and zero are equivalent). All types implement sql.Scanner, driver.Valuer, and JSON marshalers.

## Use cases
- handle nullable database columns in Go structs
- marshal nullable SQL values to JSON without pointers
- scan SQL NULL values into non-pointer struct fields
- treat empty strings and null as equivalent in JSON APIs
- omit null fields from JSON with Go 1.24 omitzero

## When to choose
- you need sql.NullXXX alternatives that marshal cleanly to JSON
- you want to avoid pointer types for optional fields
- you need both strict null and zero-as-null semantics

## When to avoid
- you prefer pointer-based optionality
- you need nullable types outside SQL/JSON contexts
- your project targets Go versions without generics for null.Value

## Facets
- artifact type: library
- maturity: stable
- function: serialization, database-driver
- domain: databases, developer-tools, backend
- platform: go
- tags: nullable-types, sql, go-library

## Member repositories
- guregu/null (main) score 27

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:10.392764+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:56:43.569088+00:00, confidence not recorded.
  - readme: https://github.com/guregu/null (fetched 2026-08-28T04:06:10.392764+00:00, sha a25b0f17f06a)
- Data as of 2026-08-30T08:39:29.467469+00:00.
