pgxcompat

package
v2.33.17 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 7 Imported by: 0

README

This package enables PGX to use parameters of type go-utility/v2/uuid. To enable support, register the type in the AfterConnect callback before connecting to the database.

dbconfig, err := pgxpool.ParseConfig(databaseURL)
if err != nil {
	// handle error
}
dbconfig.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error {
	conn.ConnInfo().RegisterDataType(pgtype.DataType{
		Value: &pgxcompat.UUID{},
		Name:  "uuid",
		OID:   pgtype.UUIDOID,
	})
	return nil
}```

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Getter

type Getter interface {
	Get() interface{}
}

type UUID

type UUID struct {
	UUID   uuid.UUID
	Status pgtype.Status
}

func (*UUID) AssignTo

func (u *UUID) AssignTo(target interface{}) (err error)

func (*UUID) DecodeBinary

func (u *UUID) DecodeBinary(_ *pgtype.ConnInfo, value []byte) error

func (*UUID) DecodeText

func (u *UUID) DecodeText(_ *pgtype.ConnInfo, value []byte) error

func (UUID) EncodeBinary

func (u UUID) EncodeBinary(_ *pgtype.ConnInfo, outBuf []byte) ([]byte, error)

func (UUID) EncodeText

func (u UUID) EncodeText(_ *pgtype.ConnInfo, outBuf []byte) ([]byte, error)

func (UUID) Get

func (u UUID) Get() interface{}

func (UUID) MarshalJSON

func (u UUID) MarshalJSON() ([]byte, error)

func (*UUID) Scan

func (u *UUID) Scan(value interface{}) error

Scan implements the database/sql Scanner interface.

func (*UUID) Set

func (u *UUID) Set(value interface{}) error

func (*UUID) UnmarshalJSON

func (u *UUID) UnmarshalJSON(b []byte) error

func (UUID) Value

func (u UUID) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

Jump to

Keyboard shortcuts

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