NullString represents a string that may be null. NullString implements the [Scanner] interface so it can be used as a scan destination:

  var s NullString
err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&s)
...
if s.Valid {
// use s.String
} else {
// NULL value
}

Hierarchy

  • NullString

Methods

Properties

Methods

  • Scan implements the [Scanner] interface.

    Parameters

    • value: any

    Returns void

  • Value implements the [driver.Valuer] interface.

    Returns any

Properties

string: string
valid: boolean

Generated using TypeDoc