utils

package
v0.0.0-...-6796344 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToPgtype

func BoolToPgtype(b bool) pgtype.Bool

BoolToPgtype converts bool to pgtype.Bool

func Float64ToPgtype

func Float64ToPgtype(f float64) pgtype.Float8

Float64ToPgtype converts float64 to pgtype.Float8

func FromBoolPointer

func FromBoolPointer(b *bool) bool

FromBoolPointer converts *bool to bool, returns default value if nil

func FromFloat64Pointer

func FromFloat64Pointer(f *float64) float64

FromFloat64Pointer converts *float64 to float64, returns default value if nil

func FromInt64Pointer

func FromInt64Pointer(i *int64) int64

FromInt64Pointer converts *int64 to int64, returns default value if nil

func FromIntPointer

func FromIntPointer(i *int) int

FromIntPointer converts *int to int, returns default value if nil

func FromStringPointer

func FromStringPointer(s *string) string

FromStringPointer converts *string to string, returns default value if nil

func Int32ToPgtype

func Int32ToPgtype(i int32) pgtype.Int4

Int32ToPgtype converts int32 to pgtype.Int4

func Int64ToPgtype

func Int64ToPgtype(i int64) pgtype.Int8

Int64ToPgtype converts int64 to pgtype.Int8

func Int64ToStringPointer

func Int64ToStringPointer(i int64) *string

Int64ToStringPointer converts an int64 to *string

func PgtypeTimestamptzToTime

func PgtypeTimestamptzToTime(t pgtype.Timestamptz) time.Time

PgtypeTimestamptzToTime converts pgtype.Timestamptz to time.Time

func PgtypeTimestamptzToTimeOrNull

func PgtypeTimestamptzToTimeOrNull(t pgtype.Timestamptz) *time.Time

PgtypeTimestamptzToTimeOrNull converts pgtype.Timestamptz to *time.Time, handling null values

func PgtypeToBool

func PgtypeToBool(b pgtype.Bool) bool

PgtypeToBool converts pgtype.Bool to bool

func PgtypeToFloat64

func PgtypeToFloat64(f pgtype.Float8) float64

PgtypeToFloat64 converts pgtype.Float8 to float64

func PgtypeToInt32

func PgtypeToInt32(i pgtype.Int4) int32

PgtypeToInt32 converts pgtype.Int4 to int32

func PgtypeToInt64

func PgtypeToInt64(i pgtype.Int8) int64

PgtypeToInt64 converts pgtype.Int8 to int64

func PgtypeToString

func PgtypeToString(t pgtype.Text) string

PgtypeToString converts pgtype.Text to string

func PgtypeToStringOrNull

func PgtypeToStringOrNull(t pgtype.Text) *string

PgtypeToStringOrNull converts pgtype.Text to *string, handling null values.

func PgtypeToTime

func PgtypeToTime(t pgtype.Timestamp) time.Time

PgtypeToTime converts pgtype.Timestamp to time.Time

func PgtypeToTimeOrNull

func PgtypeToTimeOrNull(t pgtype.Timestamp) *time.Time

PgtypeToTimeOrNull converts pgtype.Timestamp to *time.Time, handling null values.

func PgtypeToUUID

func PgtypeToUUID(id pgtype.UUID) uuid.UUID

PgtypeToUUID converts pgtype.UUID to uuid.UUID

func StringToBool

func StringToBool(s string) bool

StringToBool converts a string to a bool, returning false on error

func StringToFloat32

func StringToFloat32(s string) float32

StringToFloat32 converts a string to float32, returning 0.0 on error

func StringToFloat64

func StringToFloat64(s string) float64

StringToFloat64 converts a string to float64, returning 0.0 on error

func StringToInt32

func StringToInt32(s string) int32

StringToInt32 converts a string to int32, returning 0 on error

func StringToInt64

func StringToInt64(s string) int64

StringToInt64 converts a string to int64, returning 0 on error

func StringToPgtype

func StringToPgtype(s string) pgtype.Text

StringToPgtype converts string to pgtype.Text

func StringToPgtypeOrNull

func StringToPgtypeOrNull(s *string) pgtype.Text

StringToPgtypeOrNull converts a *string to pgtype.Text, handling null values.

func StringToTime

func StringToTime(s, layout string) time.Time

StringToTime converts a string to time.Time, returning time.Time{} on error

func StringToUint32

func StringToUint32(s string) uint32

StringToUint32 converts a string to uint32, returning 0 on error

func StringToUint64

func StringToUint64(s string) uint64

StringToUint64 converts a string to uint64, returning 0 on error

func TimeToPgtype

func TimeToPgtype(t time.Time) pgtype.Timestamp

TimeToPgtype converts time.Time to pgtype.Timestamp

func TimeToPgtypeOrNull

func TimeToPgtypeOrNull(t *time.Time) pgtype.Timestamp

TimeToPgtypeOrNull converts a *time.Time to pgtype.Timestamp, handling null values.

func TimeToPgtypeTimestamptz

func TimeToPgtypeTimestamptz(t time.Time) pgtype.Timestamptz

TimeToPgtypeTimestamptz converts time.Time to pgtype.Timestamptz

func TimeToPgtypeTimestamptzOrNull

func TimeToPgtypeTimestamptzOrNull(t *time.Time) pgtype.Timestamptz

TimeToPgtypeTimestamptzOrNull converts *time.Time to pgtype.Timestamptz, handling null values

func ToBoolPointer

func ToBoolPointer(b bool) *bool

ToBoolPointer converts a bool to *bool

func ToFloat64Pointer

func ToFloat64Pointer(f float64) *float64

ToFloat64Pointer converts a float64 to *float64

func ToInt64Pointer

func ToInt64Pointer(i int64) *int64

ToInt64Pointer converts an int64 to *int64

func ToIntPointer

func ToIntPointer(i int) *int

ToIntPointer converts an int to *int

func ToStringPointer

func ToStringPointer(s string) *string

ToStringPointer converts a string to *string

func UUIDToPgtype

func UUIDToPgtype(id uuid.UUID) pgtype.UUID

UUIDToPgtype converts uuid.UUID to pgtype.UUID

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL