Documentation
¶
Index ¶
- func NullBoolean[T bool | *bool](b T) sql.NullBool
- func NullByte[T byte | *byte](b T) sql.NullByte
- func NullFloat64[T float64 | *float64](f T) sql.NullFloat64
- func NullInt16[T int16 | *int16](i T) sql.NullInt16
- func NullInt32[T int32 | *int32](i T) sql.NullInt32
- func NullInt64[T int64 | *int64](i T) sql.NullInt64
- func NullString[T string | *string](s T) sql.NullString
- func NullTime[T time.Time | *time.Time](t T) sql.NullTime
- func NullTimeFromTimestamp(t *timestamppb.Timestamp) sql.NullTime
- func NullUUID[T uuid.UUID | *uuid.UUID](id T) uuid.NullUUID
- func Serial(in string) (uint64, error)
- func UnwrapBoolean(b sql.NullBool) *bool
- func UnwrapByte(b sql.NullByte) *byte
- func UnwrapFloat64(f sql.NullFloat64) *float64
- func UnwrapInt16(i sql.NullInt16) *int16
- func UnwrapInt32(i sql.NullInt32) *int32
- func UnwrapInt64(i sql.NullInt64) *int64
- func UnwrapString(s sql.NullString) *string
- func UnwrapTime(t sql.NullTime) time.Time
- func UnwrapTimePtr(t sql.NullTime) *time.Time
- func UnwrapTimestamp(t sql.NullTime) *timestamppb.Timestamp
- func UnwrapUUID(id uuid.NullUUID) uuid.UUID
- func UnwrapUUIDPtr(id uuid.NullUUID) *uuid.UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NullBoolean ¶ added in v1.0.0
NullBoolean converts the native go boolean type to a sql.NullBool type.
func NullFloat64 ¶ added in v1.0.0
func NullFloat64[T float64 | *float64](f T) sql.NullFloat64
NullFloat64 converts the native go float64 type to a sql.NullFloat64 type.
func NullInt16 ¶ added in v1.0.0
NullInt16 converts the native go int16 type to a sql.NullInt16 type.
func NullInt32 ¶ added in v1.0.0
NullInt32 converts the native go int32 type to a sql.NullInt32 type.
func NullInt64 ¶ added in v1.0.0
NullInt64 converts the native go int64 type to a sql.NullInt64 type.
func NullString ¶ added in v1.0.0
func NullString[T string | *string](s T) sql.NullString
NullString converts the native go string type to a sql.NullString type.
func NullTime ¶ added in v1.0.0
NullTime converts an time pointer to a sql NullTime type. This function will treats the Zero time as valid.
func NullTimeFromTimestamp ¶ added in v1.0.0
func NullTimeFromTimestamp(t *timestamppb.Timestamp) sql.NullTime
NullTimeFromTimestamp converts an timestamppb.Timestamp pointer to a sql.NullTime type. This will save you a conversion when dealing with gRPC requests.
func Serial ¶ added in v1.0.0
Serial is a notational convenience for creating unique identifier columns. It is an auto-incrementing integer starting from zero. https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL
func UnwrapBoolean ¶
UnwrapBoolean unwraps the sql.NullBool to a boolean pointer.
func UnwrapByte ¶
UnwrapByte unwraps the sql.NullByte to a byte pointer.
func UnwrapFloat64 ¶
func UnwrapFloat64(f sql.NullFloat64) *float64
UnwrapFloat64 unwraps the sql.NullFloat64 to a float64 pointer.
func UnwrapInt16 ¶
UnwrapInt16 unwraps the sql.NullInt16 to a int16 pointer.
func UnwrapInt32 ¶
UnwrapInt32 unwraps the sql.NullInt32 to a int32 pointer.
func UnwrapInt64 ¶
UnwrapInt64 unwraps the sql.NullInt64 to a int64 pointer.
func UnwrapString ¶
func UnwrapString(s sql.NullString) *string
UnwrapString unwraps the sql null string to a string pointer.
func UnwrapTime ¶
UnwrapTime unwraps the sql null time to a time.Time struct. If the value is null the function will return an empty time.Time struct.
func UnwrapTimePtr ¶ added in v1.0.0
UnwrapTimePtr unwraps the sql null time to a time.Time pointer.
func UnwrapTimestamp ¶
func UnwrapTimestamp(t sql.NullTime) *timestamppb.Timestamp
UnwrapTime unwraps the sql null time to a timestamppb.Timestamp pointer.
func UnwrapUUID ¶ added in v0.0.2
UnwrapUUID unwraps the sql null UUID to a uuid.UUID struct. If the value is null the function will return an empty uuid.UUID struct. Use UnwrapUUIDPointer() if you want a pointer value.
Types ¶
This section is empty.