pgtypecast

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PgTextToStr

func PgTextToStr(text pgtype.Text) string

PgTextToStr converts a pgtype.Text value to a string.

It takes a pgtype.Text parameter named "text" and returns a string. If the "text" parameter is not valid, it returns an empty string. Otherwise, it returns the string value of the "text" parameter.

func PgTextToStrPtr

func PgTextToStrPtr(text pgtype.Text) *string

PgTextToStrPtr converts a pgtype.Text value to a pointer to a string.

It takes a pgtype.Text parameter named "text" and returns a pointer to a string. If the "text" parameter is not valid, it returns nil. Otherwise, it returns a pointer to the string value of the "text" parameter.

func PgTimestamptzToTime

func PgTimestamptzToTime(ts pgtype.Timestamptz) time.Time

PgTimestamptzToTime converts a pgtype.Timestamptz to a time.Time.

It takes a pgtype.Timestamptz parameter named "ts" and returns a time.Time.

func PgTimestamptzToTimePtr

func PgTimestamptzToTimePtr(ts pgtype.Timestamptz) *time.Time

PgTimestamptzToTimePtr converts a pgtype.Timestamptz to a pointer to a time.Time.

It takes a pgtype.Timestamptz parameter named "ts" and returns a pointer to a time.Time. If the "ts" parameter is not valid, it returns nil. Otherwise, it returns a pointer to the Time field of the "ts" parameter.

func PgUUIDToUUID

func PgUUIDToUUID(uid pgtype.UUID) uuid.UUID

PgUUIDToUUID converts a pgtype.UUID to a uuid.UUID.

It takes a pgtype.UUID parameter named "uid" and returns a uuid.UUID.

func PgUUIDToUUIDPtr

func PgUUIDToUUIDPtr(uid pgtype.UUID) *uuid.UUID

PgUUIDToUUIDPtr converts a pgtype.UUID to a pointer to a uuid.UUID.

It takes a pgtype.UUID parameter named "uid" and returns a pointer to a uuid.UUID. If the "uid" parameter is not valid, it returns nil. Otherwise, it creates a new uuid.UUID using the Bytes field of the "uid" parameter and returns a pointer to it.

func StrPrtToPgText

func StrPrtToPgText(str *string) pgtype.Text

StrPrtToPgText converts a pointer to a string to a pgtype.Text.

It takes a pointer to a string parameter named "str" and returns a pgtype.Text. If the "str" parameter is nil, it returns a pgtype.Text with the Valid flag set to false. Otherwise, it returns a pgtype.Text with the String field set to the value of the "str" parameter and the Valid flag set to true.

func StrToPgText

func StrToPgText(str string) pgtype.Text

StrToPgText converts a string to a pgtype.Text value.

It takes a string parameter named "str" and returns a pgtype.Text value. The pgtype.Text value is created with the string value of the input parameter and a valid flag set to true.

func TimePtrToPgTimestamptz

func TimePtrToPgTimestamptz(castTime *time.Time) pgtype.Timestamptz

TimePtrToPgTimestamptz converts a pointer to a time.Time to a pgtype.Timestamptz.

It takes a pointer to a time.Time parameter named "t" and returns a pgtype.Timestamptz. If the pointer is nil, it returns a pgtype.Timestamptz with the Valid field set to false. Otherwise, it returns a pgtype.Timestamptz with the Time field set to the value of the pointer and the Valid field set to true.

Parameters: - t: A pointer to a time.Time.

Returns: - pgtype.Timestamptz: The converted pgtype.Timestamptz.

func TimeToPgTimestamptz

func TimeToPgTimestamptz(t time.Time) pgtype.Timestamptz

TimeToPgTimestamptz converts a time.Time value to a pgtype.Timestamptz value.

It takes a time.Time parameter named "t" and returns a pgtype.Timestamptz value. The returned pgtype.Timestamptz value has the Time field set to the input time value and the Valid field set to true.

Parameters: - t: The time.Time value to convert.

Returns: - pgtype.Timestamptz: The converted pgtype.Timestamptz value.

func UUIDPtrToPgUUID

func UUIDPtrToPgUUID(uid *uuid.UUID) pgtype.UUID

UUIDPtrToPgUUID converts a pointer to a uuid.UUID to a pgtype.UUID.

It takes a pointer to a uuid.UUID parameter named "uid" and returns a pgtype.UUID.

func UUIDToPgUUID

func UUIDToPgUUID(uid uuid.UUID) pgtype.UUID

UUIDToPgUUID converts a uuid.UUID to a pgtype.UUID.

It takes a uuid.UUID parameter named "uid" and returns a 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