Documentation ¶
Index ¶
- type CompositeQueryTracer
- func (t CompositeQueryTracer) TraceBatchEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchEndData)
- func (t CompositeQueryTracer) TraceBatchQuery(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchQueryData)
- func (t CompositeQueryTracer) TraceBatchStart(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchStartData) context.Context
- func (t CompositeQueryTracer) TraceConnectEnd(ctx context.Context, data pgx.TraceConnectEndData)
- func (t CompositeQueryTracer) TraceConnectStart(ctx context.Context, data pgx.TraceConnectStartData) context.Context
- func (t CompositeQueryTracer) TraceCopyFromEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceCopyFromEndData)
- func (t CompositeQueryTracer) TraceCopyFromStart(ctx context.Context, conn *pgx.Conn, data pgx.TraceCopyFromStartData) context.Context
- func (t CompositeQueryTracer) TracePrepareEnd(ctx context.Context, conn *pgx.Conn, data pgx.TracePrepareEndData)
- func (t CompositeQueryTracer) TracePrepareStart(ctx context.Context, conn *pgx.Conn, data pgx.TracePrepareStartData) context.Context
- func (t CompositeQueryTracer) TraceQueryEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceQueryEndData)
- func (t CompositeQueryTracer) TraceQueryStart(ctx context.Context, conn *pgx.Conn, data pgx.TraceQueryStartData) context.Context
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompositeQueryTracer ¶
type CompositeQueryTracer []pgx.QueryTracer
CompositeQueryTracer represent a composite query tracer
Example ¶
config, err := pgxpool.ParseConfig(os.Getenv("PGX_DATABASE_URL")) if err != nil { panic(err) } config.ConnConfig.Tracer = pgxtrace.CompositeQueryTracer{} conn, err := pgxpool.NewWithConfig(context.TODO(), config) if err != nil { panic(err) } defer conn.Close() rows, err := conn.Query(context.TODO(), "SELECT * from customer") if err != nil { panic(err) } // close the rows defer rows.Close() // Customer struct must be defined type Customer struct { FirstName string `db:"first_name"` LastName string `db:"last_name"` } for rows.Next() { customer, err := pgx.RowToStructByName[Customer](rows) if err != nil { panic(err) } fmt.Println(customer.FirstName) }
Output:
func (CompositeQueryTracer) TraceBatchEnd ¶
func (t CompositeQueryTracer) TraceBatchEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchEndData)
TraceBatchEnd implements pgx.BatchTracer.
func (CompositeQueryTracer) TraceBatchQuery ¶
func (t CompositeQueryTracer) TraceBatchQuery(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchQueryData)
TraceBatchQuery implements pgx.BatchTracer.
func (CompositeQueryTracer) TraceBatchStart ¶
func (t CompositeQueryTracer) TraceBatchStart(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchStartData) context.Context
TraceBatchStart implements pgx.BatchTracer.
func (CompositeQueryTracer) TraceConnectEnd ¶
func (t CompositeQueryTracer) TraceConnectEnd(ctx context.Context, data pgx.TraceConnectEndData)
TraceConnectEnd implements pgx.ConnectTracer.
func (CompositeQueryTracer) TraceConnectStart ¶
func (t CompositeQueryTracer) TraceConnectStart(ctx context.Context, data pgx.TraceConnectStartData) context.Context
TraceConnectStart implements pgx.ConnectTracer.
func (CompositeQueryTracer) TraceCopyFromEnd ¶
func (t CompositeQueryTracer) TraceCopyFromEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceCopyFromEndData)
TraceCopyFromEnd implements pgx.CopyFromTracer.
func (CompositeQueryTracer) TraceCopyFromStart ¶
func (t CompositeQueryTracer) TraceCopyFromStart(ctx context.Context, conn *pgx.Conn, data pgx.TraceCopyFromStartData) context.Context
TraceCopyFromStart implements pgx.CopyFromTracer.
func (CompositeQueryTracer) TracePrepareEnd ¶
func (t CompositeQueryTracer) TracePrepareEnd(ctx context.Context, conn *pgx.Conn, data pgx.TracePrepareEndData)
TracePrepareEnd implements pgx.PrepareTracer.
func (CompositeQueryTracer) TracePrepareStart ¶
func (t CompositeQueryTracer) TracePrepareStart(ctx context.Context, conn *pgx.Conn, data pgx.TracePrepareStartData) context.Context
TracePrepareStart implements pgx.PrepareTracer.
func (CompositeQueryTracer) TraceQueryEnd ¶
func (t CompositeQueryTracer) TraceQueryEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceQueryEndData)
TraceQueryEnd implements pgx.QueryTracer.
func (CompositeQueryTracer) TraceQueryStart ¶
func (t CompositeQueryTracer) TraceQueryStart(ctx context.Context, conn *pgx.Conn, data pgx.TraceQueryStartData) context.Context
TraceQueryStart implements pgx.QueryTracer.
Click to show internal directories.
Click to hide internal directories.