goracle

package module
v2.1.14+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

README

Build Status GoDoc

goracle

goracle is a package which is a database/sql/driver.Driver for connecting to Oracle DB, using Anthony Tuininga's excellent OCI wrapper, ODPI-C.

At least Go 1.9 is required!

Connect

In sql.Open("goracle", connString), you can provide the classic "user/passw@sid" as connString, or an URL like "oracle://user:passw@sid".

You can provide all possible options with ConnectionParams.

Rationale

With Go 1.9, driver-specific things are not needed, everything (I need) can be achieved with the standard database/sql library. Even calling stored procedures with OUT parameters, or sending/retrieving PL/SQL array types - just give a goracle.PlSQLArrays Option within the parameters of Exec!

The array size of the returned PL/SQL arrays can be set with goracle.ArraySize(2000)

  • the default is 1024.

Connections are pooled by default (except AS SYSOPER or AS SYSDBA).

Speed

Correctness and simplicity is more important than speed, but the underlying ODPI-C library helps a lot with the lower levels, so the performance is not bad.

Queries are prefetched (256 rows by default, can be changed by adding a goracle.FetchRowCount(1000) argument to the call of Query), but you can speed up INSERT/UPDATE/DELETE statements by providing all the subsequent parameters at once, by putting each param's subsequent elements in a separate slice:

Instead of

db.Exec("INSERT INTO table (a, b) VALUES (:1, :2)", 1, "a")
db.Exec("INSERT INTO table (a, b) VALUES (:1, :2)", 2, "b")

do

db.Exec("INSERT INTO table (a, b) VALUES (:1, :2)", []int{1, 2}, []string{"a", "b"})

.

Logging

Goracle uses github.com/go-kit/kit/log's concept of a Log function. Either set goracle.Log to a logging function globally, or (better) set the logger in the Context of ExecContext or QueryContext:

db.QueryContext(goracle.ContextWithLog(ctx, logger.Log), qry)

Tracing

To set ClientIdentifier, ClientInfo, Module, Action and DbOp on the session, to be seen in the Database by the Admin, set goracle.TraceTag on the Context:

db.QueryContext(goracle.ContextWithTraceTag(goracle.TraceTag{
	Module: "processing",
	Action: "first",
}), qry)

Extras

To use the goracle-specific functions, you'll need a *goracle.conn. That's what goracle.DriverConn is for! See z_qrcn_test.go for using that to reach NewSubscription.

Install

Just

go get gopkg.in/goracle.v2

and you're ready to go!

Windows may need some newer gcc (mingw-w64 with gcc 7.2.0).

Contribute

Just as with other Go projects, you don't want to change the import paths, but you can hack on the library in place, just set up different remotes:

cd $GOPATH.src/gopkg.in/goracle.v2
git remote add upstream https://github.com/go-goracle/goracle.git
git fetch upstream
git checkout -b master upstream/master

git checkout -f master
git pull upstream master
git remote add fork git@github.com:mygithubacc/goracle
git checkout -b newfeature upstream/master

Change, experiment as you wish, then

git commit -m 'my great changes' *.go
git push fork newfeature

and you're ready to send a GitHub Pull Request from github.com/mygithubacc/goracle, newfeature branch.

As the ODPI-C sources are included as git submodule, don't forget to

git submodule update --init
# or
go generate

to update ODPI-C, too. If you want to refresh ODPI-C, you can:

cd odpi
git pull
cd ..
git add odpi
git commit -m 'upgrade odpi to <git commit hash of odpi>' odpi
pre-commit

Add this to .git/hooks/pre-commit

#!/bin/sh
set -e

output="$(gofmt -l "$@")"

if [ -n "$output" ]; then
	echo >&2 "Go files must be formatted with gofmt. Please run:"
	for f in $output; do
		echo >&2 "  gofmt -w $PWD/$f"
	done
	exit 1
fi

for file in "$@"; do
	go vet "$file"
done

gometalinter --vendor --disable-all \
  --enable=deadcode \
  --enable=ineffassign \
  --enable=gosimple \
  --enable=staticcheck \
  --enable=unused \
  --enable=vetshadow \
  ./...

Third-party

  • oracall generates a server for calling stored procedures.

Documentation

Overview

Package goracle is a database/sql/driver for Oracle DB.

The connection string for the sql.Open("goracle", connString) call can be the simple

loin/password@sid [AS SYSDBA|AS SYSOPER]

type (with sid being the sexp returned by tnsping), or in the form of

ora://login:password@sid/? \
  sysdba=0& \
  sysoper=0& \
  poolMinSessions=1& \
  poolMaxSessions=1000& \
  poolIncrement=1& \
  connectionClass=POOLED

These are the defaults. Many advocate that a static session pool (min=max, incr=0) is better, with 1-10 sessions per CPU thread. See http://docs.oracle.com/cd/E82638_01/JJUCP/optimizing-real-world-performance.htm#JJUCP-GUID-BC09F045-5D80-4AF5-93F5-FEF0531E0E1D

If you specify connectionClass, that'll reuse the same session pool without the connectionClass, but will specify it on each session acquire. Thus you can cluster the session pool with classes, or ose POOLED for DRCP.

Index

Constants

View Source
const (
	// DefaultFetchRowCount is the number of prefetched rows by default (if not changed through FetchRowCount statement option).
	DefaultFetchRowCount = 1 << 8

	// DefaultArraySize is the length of the maximum PL/SQL array by default (if not changed through ArraySize statement option).
	DefaultArraySize = 1 << 10
)
View Source
const (
	// DpiMajorVersion is the wanted major version of the underlying ODPI-C library.
	DpiMajorVersion = C.DPI_MAJOR_VERSION
	// DpiMinorVersion is the wanted minor version of the underlying ODPI-C library.
	DpiMinorVersion = C.DPI_MINOR_VERSION

	// DriverName is set on the connection to be seen in the DB
	DriverName = "gopkg.in/goracle.v2 : " + Version

	// DefaultPoolMinSessions specifies the default value for minSessions for pool creation.
	DefaultPoolMinSessions = 1
	// DefaultPoolMaxSessions specifies the default value for maxSessions for pool creation.
	DefaultPoolMaxSessions = 1000
	// DefaultPoolIncrement specifies the default value for increment for pool creation.
	DefaultPoolIncrement = 1
	// DefaultConnectionClass is the defailt connectionClass
	DefaultConnectionClass = "GORACLE"
)

Events that can be watched.

View Source
const (
	// OpAll Indicates that notifications should be sent for all operations on the table or query.
	OpAll = Operation(C.DPI_OPCODE_ALL_OPS)
	// OpAllRows Indicates that all rows have been changed in the table or query (or too many rows were changed or row information was not requested).
	OpAllRows = Operation(C.DPI_OPCODE_ALL_ROWS)
	// OpInsert Indicates that an insert operation has taken place in the table or query.
	OpInsert = Operation(C.DPI_OPCODE_INSERT)
	// OpUpdate Indicates that an update operation has taken place in the table or query.
	OpUpdate = Operation(C.DPI_OPCODE_UPDATE)
	// OpDelete Indicates that a delete operation has taken place in the table or query.
	OpDelete = Operation(C.DPI_OPCODE_DELETE)
	// OpAlter Indicates that the registered table or query has been altered.
	OpAlter = Operation(C.DPI_OPCODE_ALTER)
	// OpDrop Indicates that the registered table or query has been dropped.
	OpDrop = Operation(C.DPI_OPCODE_DROP)
	// OpUnknown An unknown operation has taken place.
	OpUnknown = Operation(C.DPI_OPCODE_UNKNOWN)
)
View Source
const Version = "v2.1.14"

Version of this driver

Variables

View Source
var (
	// Int64 for converting to-from int64.
	Int64 = intType{}
	// Float64 for converting to-from float64.
	Float64 = floatType{}
	// Num for converting to-from Number (string)
	Num = numType{}
)
View Source
var ErrNotCollection = errors.New("not collection")

ErrNotCollection is returned when the Object is not a collection.

View Source
var ErrNotExist = errors.New("not exist")

ErrNotExist is returned when the collection's requested element does not exist.

View Source
var Log func(...interface{}) error

Log function. By default, it's nil, and thus logs nothing. If you want to change this, change it to a github.com/go-kit/kit/log.Swapper.Log or analog to be race-free.

Functions

func CallbackSubscr

func CallbackSubscr(ctx unsafe.Pointer, message *C.dpiSubscrMessage)

CallbackSubscr is the callback for C code on subscription event.

func ContextWithLog

func ContextWithLog(ctx context.Context, logF func(...interface{}) error) context.Context

ContextWithLog returns a context with the given log function.

func ContextWithTraceTag

func ContextWithTraceTag(ctx context.Context, tt TraceTag) context.Context

ContextWithTraceTag returns a context with the specified TraceTag, which will be set on the session used.

func EnableDbmsOutput

func EnableDbmsOutput(ctx context.Context, conn Execer) error

EnableDbmsOutput enables DBMS_OUTPUT buffering on the given connection. This is required if you want to retrieve the output with ReadDbmsOutput later.

func MapToSlice

func MapToSlice(qry string, metParam func(string) interface{}) (string, []interface{})

MapToSlice modifies query for map (:paramname) to :%d placeholders + slice of params.

Calls metParam for each parameter met, and returns the slice of their results.

func NamedToOrdered

func NamedToOrdered(qry string, namedParams map[string]interface{}) (string, []interface{})

NamedToOrdered converts the query from named params (:paramname) to :%d placeholders + slice of params, copying the params verbatim.

func ReadDbmsOutput

func ReadDbmsOutput(ctx context.Context, w io.Writer, conn preparer) error

ReadDbmsOutput copies the DBMS_OUTPUT buffer into the given io.Writer.

Types

type Column

type Column struct {
	Name       string
	OracleType C.dpiOracleTypeNum
	NativeType C.dpiNativeTypeNum
	Size       C.uint32_t
	Precision  C.int16_t
	Scale      C.int8_t
	Nullable   bool
	ObjectType *C.dpiObjectType
}

Column holds the info from a column.

type CompileError

type CompileError struct {
	Owner, Name, Type    string
	Line, Position, Code int64
	Text                 string
	Warning              bool
}

CompileError represents a compile-time error as in user_errors view.

func GetCompileErrors

func GetCompileErrors(queryer queryer, all bool) ([]CompileError, error)

GetCompileErrors returns the slice of the errors in user_errors.

If all is false, only errors are returned; otherwise, warnings, too.

func (CompileError) Error

func (ce CompileError) Error() string

type Conn

type Conn interface {
	driver.Conn
	driver.Pinger
	Break() error
	BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
	PrepareContext(ctx context.Context, query string) (driver.Stmt, error)
	Commit() error
	Rollback() error
	ServerVersion() (VersionInfo, error)
	GetObjectType(name string) (*ObjectType, error)
	NewSubscription(string, func(Event)) (*Subscription, error)
}

func DriverConn

func DriverConn(ex Execer) (Conn, error)

DriverConn returns the *goracle.conn of the databas/sql.Conn

type ConnectionParams

type ConnectionParams struct {
	Username, Password, SID, ConnClass      string
	IsSysDBA, IsSysOper                     bool
	MinSessions, MaxSessions, PoolIncrement int
}

ConnectionParams holds the params for a connection (pool). You can use ConnectionParams{...}.String() as a connection string in sql.Open.

func ParseConnString

func ParseConnString(connString string) (ConnectionParams, error)

ParseConnString parses the given connection string into a struct.

func (ConnectionParams) String

func (P ConnectionParams) String() string

func (ConnectionParams) StringNoClass

func (P ConnectionParams) StringNoClass() string

StringNoClass returns the string representation of ConnectionParams, without class info.

type Data

type Data struct {
	NativeTypeNum C.dpiNativeTypeNum
	// contains filtered or unexported fields
}

Data holds the data to/from Oracle.

func (*Data) Get

func (d *Data) Get() interface{}

Get returns the contents of Data.

func (*Data) GetBool

func (d *Data) GetBool() bool

GetBool returns the bool data.

func (*Data) GetBytes

func (d *Data) GetBytes() []byte

GetBytes returns the []byte from the data.

func (*Data) GetFloat32

func (d *Data) GetFloat32() float32

GetFloat32 gets float32 from the data.

func (*Data) GetFloat64

func (d *Data) GetFloat64() float64

GetFloat64 gets float64 from the data.

func (*Data) GetInt64

func (d *Data) GetInt64() int64

GetInt64 gets int64 from the data.

func (*Data) GetIntervalDS

func (d *Data) GetIntervalDS() time.Duration

GetIntervalDS gets duration as interval date-seconds from data.

func (*Data) GetIntervalYM

func (d *Data) GetIntervalYM() IntervalYM

GetIntervalYM gets IntervalYM from the data.

func (*Data) GetLob

func (d *Data) GetLob() *Lob

GetLob gets data as Lob.

func (*Data) GetObject

func (d *Data) GetObject() *Object

GetObject gets Object from data.

func (*Data) GetStmt

func (d *Data) GetStmt() driver.Stmt

GetStmt gets Stmt from data.

func (*Data) GetTime

func (d *Data) GetTime() time.Time

GetTime gets Time from data.

func (*Data) GetUint64

func (d *Data) GetUint64() uint64

GetUint64 gets data as uint64.

func (*Data) IsNull

func (d *Data) IsNull() bool

IsNull returns whether the data is null.

func (*Data) SetBool

func (d *Data) SetBool(b bool)

SetBool sets the data as bool.

func (*Data) SetBytes

func (d *Data) SetBytes(b []byte)

SetBytes set the data as []byte.

func (*Data) SetFloat32

func (d *Data) SetFloat32(f float32)

SetFloat32 sets the data as float32.

func (*Data) SetFloat64

func (d *Data) SetFloat64(f float64)

SetFloat64 sets the data as float64.

func (*Data) SetInt64

func (d *Data) SetInt64(i int64)

SetInt64 sets the data as int64.

func (*Data) SetIntervalDS

func (d *Data) SetIntervalDS(dur time.Duration)

SetIntervalDS sets the duration as interval date-seconds to data.

func (*Data) SetIntervalYM

func (d *Data) SetIntervalYM(ym IntervalYM)

SetIntervalYM sets IntervalYM to the data.

func (*Data) SetObject

func (d *Data) SetObject(o *Object)

SetObject sets Object to data.

func (*Data) SetStmt

func (d *Data) SetStmt(s *statement)

SetStmt sets Stmt to data.

func (*Data) SetTime

func (d *Data) SetTime(t time.Time)

SetTime sets Time to data.

func (*Data) SetUint64

func (d *Data) SetUint64(u uint64)

SetUint64 sets data to uint64.

type DataTypeInfo

type DataTypeInfo struct {
	OracleTypeNum                       C.dpiOracleTypeNum
	NativeTypeNum                       C.dpiNativeTypeNum
	ObjectType                          *ObjectType
	DBSize, ClientSizeInBytes, CharSize int
	Precision                           int16
	Scale                               int8
	FsPrecision                         uint8
}

DataTypeInfo holds type info for a Data.

type DirectLob

type DirectLob struct {
	// contains filtered or unexported fields
}

DirectLob holds a Lob and allows direct (Read/WriteAt, not streaming Read/Write) operations on it.

func (*DirectLob) Close

func (dl *DirectLob) Close() error

Close the Lob.

func (*DirectLob) ReadAt

func (dl *DirectLob) ReadAt(p []byte, offset int64) (int, error)

ReadAt reads at most len(p) bytes into p at offset.

func (*DirectLob) WriteAt

func (dl *DirectLob) WriteAt(p []byte, offset int64) (int, error)

WriteAt writes p starting at offset.

type Event

type Event struct {
	Err     error
	Type    EventType
	DB      string
	Tables  []TableEvent
	Queries []QueryEvent
}

Event for a subscription.

type EventType

type EventType C.dpiEventType

EventType is the type of an event.

type Execer

type Execer interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
}

Execer is the ExecContext of sql.Conn.

type IntervalYM

type IntervalYM struct {
	Years, Months int
}

IntervalYM holds Years and Months as interval.

type Lob

type Lob struct {
	io.Reader
	IsClob bool
}

Lob is for reading/writing a LOB.

func (*Lob) Hijack

func (lob *Lob) Hijack() (*DirectLob, error)

Hijack the underlying lob reader/writer, and return a DirectLob for reading/writing the lob directly.

After this, the Lob is unusable!

type Number

type Number string

Number as string

func (Number) MarshalJSON

func (n Number) MarshalJSON() ([]byte, error)

func (Number) MarshalText

func (n Number) MarshalText() ([]byte, error)

func (*Number) Scan

func (n *Number) Scan(v interface{}) error

Scan into the Number from a driver.Value.

func (Number) String

func (n Number) String() string

func (*Number) UnmarshalJSON

func (n *Number) UnmarshalJSON(p []byte) error

func (*Number) UnmarshalText

func (n *Number) UnmarshalText(p []byte) error

func (Number) Value

func (n Number) Value() (driver.Value, error)

Value returns the Number as driver.Value

type Object

type Object struct {
	*ObjectType
	// contains filtered or unexported fields
}

Object represents a dpiObject.

func (Object) ClientVersion

func (d Object) ClientVersion() (VersionInfo, error)

func (*Object) GetAttribute

func (O *Object) GetAttribute(data *Data, i int) error

GetAttribute gets the i-th attribute into data.

func (Object) Open

func (d Object) Open(connString string) (driver.Conn, error)

Open returns a new connection to the database. The name is a string in a driver-specific format.

func (*Object) SetAttribute

func (O *Object) SetAttribute(i int, data *Data) error

SetAttribute sets the i-th attribute with data.

type ObjectAttribute

type ObjectAttribute struct {
	Name string
	DataTypeInfo
	// contains filtered or unexported fields
}

ObjectAttribute is an attribute of an Object.

func (ObjectAttribute) ClientVersion

func (d ObjectAttribute) ClientVersion() (VersionInfo, error)

func (ObjectAttribute) Close

func (A ObjectAttribute) Close() error

Close the ObjectAttribute.

func (ObjectAttribute) Open

func (d ObjectAttribute) Open(connString string) (driver.Conn, error)

Open returns a new connection to the database. The name is a string in a driver-specific format.

type ObjectCollection

type ObjectCollection struct {
	Object
}

ObjectCollection represents a Collection of Objects - itself an Object, too.

func (*ObjectCollection) Append

func (O *ObjectCollection) Append(data *Data) error

Append data to the collection.

func (ObjectCollection) ClientVersion

func (d ObjectCollection) ClientVersion() (VersionInfo, error)

func (*ObjectCollection) Delete

func (O *ObjectCollection) Delete(i int) error

Delete i-th element of the collection.

func (*ObjectCollection) First

func (O *ObjectCollection) First() (int, error)

First returns the first element's index of the collection.

func (*ObjectCollection) Get

func (O *ObjectCollection) Get(data *Data, i int) error

Get the i-th element of the collection into data.

func (*ObjectCollection) Last

func (O *ObjectCollection) Last() (int, error)

Last returns the index of the last element.

func (*ObjectCollection) Len

func (O *ObjectCollection) Len() (int, error)

Len returns the length of the collection.

func (*ObjectCollection) Next

func (O *ObjectCollection) Next(i int) (int, error)

Next returns the succeeding index of i.

func (ObjectCollection) Open

func (d ObjectCollection) Open(connString string) (driver.Conn, error)

Open returns a new connection to the database. The name is a string in a driver-specific format.

func (*ObjectCollection) Set

func (O *ObjectCollection) Set(i int, data *Data) error

Set the i-th element of the collection with data.

func (*ObjectCollection) Trim

func (O *ObjectCollection) Trim(n int) error

Trim the collection to n.

type ObjectCollectionInfo

type ObjectCollectionInfo interface {
	OracleTypeNum() C.dpiOracleTypeNum
	NativeTypeNum() C.dpiNativeTypeNum
	ObjectType() *ObjectType
}

ObjectCollectionInfo holds type info of the collection.

type ObjectInfo

type ObjectInfo interface {
	Schema() string
	Name() string
	NumAttributes() int
	IsCollection() bool
}

ObjectInfo holds Object type info.

type ObjectType

type ObjectType struct {
	// contains filtered or unexported fields
}

ObjectType holds type info of an Object.

func GetObjectType

func GetObjectType(ex Execer, typeName string) (*ObjectType, error)

GetObjectType returns the ObjectType for the name.

func (*ObjectType) Attributes

func (t *ObjectType) Attributes() ([]ObjectAttribute, error)

Attributes of the ObjectType.

func (ObjectType) ClientVersion

func (d ObjectType) ClientVersion() (VersionInfo, error)

func (*ObjectType) Info

func (t *ObjectType) Info() (ObjectInfo, error)

Info returns ObjectInfo of the ObjectType.

func (*ObjectType) NewObject

func (t *ObjectType) NewObject() (*Object, error)

NewObject returns a new Object with ObjectType type.

func (ObjectType) Open

func (d ObjectType) Open(connString string) (driver.Conn, error)

Open returns a new connection to the database. The name is a string in a driver-specific format.

type Operation

type Operation C.dpiOpCode

Operation in the DB.

type Option

type Option func(*stmtOptions)

Option holds statement options.

var PlSQLArrays Option = func(o *stmtOptions) { o.plSQLArrays = true }

PlSQLArrays is to signal that the slices given in arguments of Exec to be left as is - the default is to treat them as arguments for ExecMany.

func ArraySize

func ArraySize(arraySize int) Option

ArraySize returns an option to set the array size to be used, overriding DefaultArraySize.

func FetchRowCount

func FetchRowCount(rowCount int) Option

FetchRowCount returns an option to set the rows to be fetched, overriding DefaultFetchRowCount.

func ParseOnly

func ParseOnly() Option

ParseOnly returns an option to set the ExecMode to only Parse.

type OraErr

type OraErr struct {
	// contains filtered or unexported fields
}

func (*OraErr) Code

func (oe *OraErr) Code() int

func (*OraErr) Error

func (oe *OraErr) Error() string

func (*OraErr) Message

func (oe *OraErr) Message() string

type QueryColumn

type QueryColumn struct {
	Name                           string
	Type, Length, Precision, Scale int
	Nullable                       bool
}

QueryColumn is the described column.

func DescribeQuery

func DescribeQuery(ctx context.Context, db Execer, qry string) ([]QueryColumn, error)

DescribeQuery describes the columns in the qry.

This can help using unknown-at-compile-time, a.k.a. dynamic queries.

type QueryEvent

type QueryEvent struct {
	Operation
	ID     uint64
	Tables []TableEvent
}

QueryEvent is an event of a Query.

type RowEvent

type RowEvent struct {
	Operation
	Rowid string
}

RowEvent is for row-related event.

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

Subscription for events in the DB.

func (Subscription) Begin deprecated

func (c Subscription) Begin() (driver.Tx, error)

Begin starts and returns a new transaction.

Deprecated: Drivers should implement ConnBeginTx instead (or additionally).

func (Subscription) BeginTx

func (c Subscription) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)

BeginTx starts and returns a new transaction. If the context is canceled by the user the sql package will call Tx.Rollback before discarding and closing the connection.

This must check opts.Isolation to determine if there is a set isolation level. If the driver does not support a non-default level and one is set or if there is a non-default isolation level that is not supported, an error must be returned.

This must also check opts.ReadOnly to determine if the read-only value is true to either set the read-only transaction property if supported or return an error if it is not supported.

func (Subscription) Break

func (c Subscription) Break() error

func (*Subscription) Close

func (s *Subscription) Close() error

Close the subscription.

func (Subscription) Commit

func (c Subscription) Commit() error

func (Subscription) GetObjectType

func (c Subscription) GetObjectType(name string) (*ObjectType, error)

GetObjectType returns the ObjectType of a name.

func (Subscription) NewSubscription

func (c Subscription) NewSubscription(name string, cb func(Event)) (*Subscription, error)

NewSubscription creates a new Subscription in the DB.

func (Subscription) Ping

func (c Subscription) Ping(ctx context.Context) error

func (Subscription) Prepare

func (c Subscription) Prepare(query string) (driver.Stmt, error)

Prepare returns a prepared statement, bound to this connection.

func (Subscription) PrepareContext

func (c Subscription) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)

PrepareContext returns a prepared statement, bound to this connection. context is for the preparation of the statement, it must not store the context within the statement itself.

func (*Subscription) Register

func (s *Subscription) Register(qry string, params ...interface{}) error

Register a query for Change Notification.

func (Subscription) Rollback

func (c Subscription) Rollback() error

func (Subscription) ServerVersion

func (c Subscription) ServerVersion() (VersionInfo, error)

type TableEvent

type TableEvent struct {
	Operation
	Name string
	Rows []RowEvent
}

TableEvent is for a Table-related event.

type TraceTag

type TraceTag struct {
	// ClientIdentifier - specifies an end user based on the logon ID, such as HR.HR
	ClientIdentifier string
	// ClientInfo - client-specific info
	ClientInfo string
	// DbOp - database operation
	DbOp string
	// Module - specifies a functional block, such as Accounts Receivable or General Ledger, of an application
	Module string
	// Action - specifies an action, such as an INSERT or UPDATE operation, in a module
	Action string
}

type VersionInfo

type VersionInfo struct {
	Version, Release, Update, PortRelease, PortUpdate, Full int
	ServerRelease                                           string
}

VersionInfo holds version info returned by Oracle DB.

func ClientVersion

func ClientVersion(ex Execer) (VersionInfo, error)

ClientVersion returns the VersionInfo from the DB.

func ServerVersion

func ServerVersion(ex Execer) (VersionInfo, error)

ServerVersion returns the VersionInfo of the client.

func (VersionInfo) String

func (V VersionInfo) String() string

Jump to

Keyboard shortcuts

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