mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 05:32:17 +02:00
sqldb: add SQLInt16 helper
This commit is contained in:
@@ -11,6 +11,18 @@ import (
|
||||
// reset function ExecTx calls.
|
||||
var NoOpReset = func() {}
|
||||
|
||||
// SQLInt16 turns a numerical integer type into the NullInt16 that sql/sqlc
|
||||
// uses when an integer field can be permitted to be NULL.
|
||||
//
|
||||
// We use this constraints.Integer constraint here which maps to all signed and
|
||||
// unsigned integer types.
|
||||
func SQLInt16[T constraints.Integer](num T) sql.NullInt16 {
|
||||
return sql.NullInt16{
|
||||
Int16: int16(num),
|
||||
Valid: true,
|
||||
}
|
||||
}
|
||||
|
||||
// SQLInt32 turns a numerical integer type into the NullInt32 that sql/sqlc
|
||||
// uses when an integer field can be permitted to be NULL.
|
||||
//
|
||||
|
Reference in New Issue
Block a user