pporacle

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

pporacle

This package instruments the sijms/go-ora/v2 package.

Installation

$ go get github.com/pinpoint-apm/pinpoint-go-agent/plugin/oracle
import "github.com/pinpoint-apm/pinpoint-go-agent/plugin/oracle"

Usage

PkgGoDev

This package instruments the Oracle driver calls. Use this package's driver in place of the Oracle driver.

db, err := sql.Open("oracle-pinpoint", "oracle://scott:tiger@localhost:1521/xe")

It is necessary to pass the context containing the pinpoint.Tracer to all exec and query methods on SQL driver.

ctx := pinpoint.NewContext(context.Background(), tracer)
row, err := db.QueryContext(ctx, "SELECT * FROM BONUS")
import (
    "database/sql"
    "github.com/pinpoint-apm/pinpoint-go-agent"
    _ "github.com/pinpoint-apm/pinpoint-go-agent/plugin/oracle"
)

func query(w http.ResponseWriter, r *http.Request) {
    conn, err := sql.Open("oracle-pinpoint", "oracle://scott:tiger@localhost:1521/xe")
    rows, _ := conn.QueryContext(r.Context(), "SELECT * FROM BONUS")

    for rows.Next() {
        err = rows.Scan(&ename, &job, &sal, &comm)
        fmt.Println("ENAME: ", ename, "\tJOB: ", job, "\tSAL: ", sal, "\tCOMM: ", comm)
    }
}

Full Example Source

Documentation

Overview

Package pporacle instruments the sijms/go-ora/v2 package (https://github.com/sijms/go-ora).

This package instruments the Oracle driver calls. Use this package's driver in place of the Oracle driver.

db, err := sql.Open("oracle-pinpoint", "oracle://scott:tiger@localhost:1521/xe")

It is necessary to pass the context containing the pinpoint.Tracer to all exec and query methods on SQL driver.

ctx := pinpoint.NewContext(context.Background(), tracer)
row := db.QueryRowContext(ctx, "SELECT * FROM BONUS")

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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