1 // Package zeronull contains types that automatically convert between database NULLs and Go zero values. 2 /* 3 Sometimes the distinction between a zero value and a NULL value is not useful at the application level. For example, 4 in PostgreSQL an empty string may be stored as NULL. There is usually no application level distinction between an 5 empty string and a NULL string. Package zeronull implements types that seamlessly convert between PostgreSQL NULL and 6 the zero value. 7 8 It is recommended to convert types at usage time rather than instantiate these types directly. In the example below, 9 middlename would be stored as a NULL. 10 11 firstname := "John" 12 middlename := "" 13 lastname := "Smith" 14 _, err := conn.Exec( 15 ctx, 16 "insert into people(firstname, middlename, lastname) values($1, $2, $3)", 17 zeronull.Text(firstname), 18 zeronull.Text(middlename), 19 zeronull.Text(lastname), 20 ) 21 */ 22 package zeronull 23