go_ora

package module
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 48 Imported by: 0

README

go-ora v3

Pure Go Oracle database driver for database/sql - a major rewrite with new abstractions, new types, and improved performance.

What's New in v3

1. Architecture Abstractions

v3 introduces a modular architecture with clear separation of concerns:

Network & Session (network/)
  • Full abstraction of the Oracle TTC (Two-Task Common) protocol
  • Packet-based communication layer (ConnectPacket, DataPacket, MarkerPacket, etc.)
  • MemorySession for in-memory buffer operations (parameter encoding, AQ message marshaling)
  • TLS/SSL negotiation and support
  • Connection break/cancel with OOB (out-of-band) support
  • Redirect handling
Connection (Connection)
  • driver.Connector interface support via OracleConnector
  • Pluggable Dialer, TLSConfig, Kerberos, and Wallet configuration
  • Automatic reconnection on bad connections
  • Session parameter management at driver level
Types (types/)
  • Complete type system with encoding/decoding abstraction
  • Each Oracle type has its own Go implementation
  • Unified SetValue / Value / Scan / CopyTo interface
  • LOB streaming support via LobStreamer interface
Parameter Encoding/Decoding (parameter_coder/)
  • Pluggable OracleParameterCoder interface for encoding and decoding
  • Three-way type mapping: Oracle type ID → Go reflect.Type → SQL type name
  • Custom type registration via AddParameterCoder
  • Each parameter type (string, number, date, vector, json, bool, LOB, etc.) has its own coder implementation

v3 implements Oracle's Fast Authentication mechanism (TTC version 24):

  • Fast Login: When the server supports it (FastAuthEnabled), the driver uses a reduced negotiation round-trip, skipping full TCP and data type negotiation on subsequent connections.
  • Cookie Login: Server negotiation results are cached in an in-memory ConnectionCookie store. On reconnection, cached data (charset, capabilities, version) is sent directly to the server, avoiding repeated negotiation.
  • Token Login: Support for token-based authentication via TokenFile and TokenPrivateKeyFile configuration options.
// Token-based connection
db, err := sql.Open("oracle", "oracle://user@host:1521/service?TOKEN_FILE=token.enc&TOKEN_PRIVATE_KEY_FILE=key.pem")
3. Client Version 24

v3 upgrades the TTC protocol version to 24, enabling:

  • Big CLR chunks (ClrChunkSize = 0x7FFF)
  • Fast Session Affinity Protocol (FSAP) capability
  • Extended data type negotiation
  • Improved session property handling
4. New Oracle Type Support
VECTOR (Oracle 23ai)

Full support for the VECTOR data type with multiple element formats:

import "github.com/sijms/go-ora/v3/types"

// Create vectors from Go slices
v1, _ := types.CreateVector([]uint8{10, 20, 30})       // INT8
v2, _ := types.CreateVector([]float32{-10.1, -20.2})    // FLOAT32
v3, _ := types.CreateVector([]float64{10.1, 20.2, 30.3}) // FLOAT64

// Scan from database
var vec types.Vector
row.Scan(&vec)

// Copy to typed slices
var data []float32
vec.CopyTo(&data)

Supported formats: INT8 (uint8), FLOAT32, FLOAT64 - both dense and sparse vectors.

JSON (Oracle 21c+)

Native JSON type support with pluggable coders:

import "github.com/sijms/go-ora/v3/types"

var js types.Json
js.SetValue(`{"key": "value"}`)

// Copy to Go types
var s string
js.CopyTo(&s)

var m map[string]interface{}
js.CopyTo(&m)

Supports oson (Oracle Binary JSON) encoding via the types/oson package.

BOOLEAN (Oracle 23c+)

Native Oracle BOOLEAN type support:

import "github.com/sijms/go-ora/v3/types"

input := types.Bool{}
input.SetValue(true)

// Use in PL/SQL calls
db.Exec("BEGIN my_proc(:1, :2); END;", input, go_ora.Out{Dest: &message})
5. Advanced Queuing (AQ)

Full Oracle Advanced Queuing support via the aq package:

import "github.com/sijms/go-ora/v3/aq"

// Create a queue
queue, err := aq.CreateQueue(db, "my_queue", aq.RAW, "")

// Enqueue a message
msg, _ := queue.NewMessage([]byte("hello"))
queue.Enqueue(msg)

// Dequeue a message
deqOpts := &aq.DequeueOptions{
    Consumer: "my_consumer",
    Mode:     aq.DequeueModeBrowse,
    Wait:     5,  // seconds
}
msg, err = queue.Dequeue(deqOpts)

Supported message types: RAW, JSON, UDT, XML.

Features:

  • Single and batch enqueue/dequeue
  • Persistent and buffered delivery modes
  • Visibility modes (on-commit, immediate)
  • Dequeue modes (browse, locked, remove)
  • Navigation modes (first, next, transactional)
  • Message expiration and delay
  • Correlation-based filtering
6. User-Defined Types (UDT)

Enhanced UDT registration with nested type support:

// Register a type with its array counterpart
go_ora.RegisterType(db, "MY_OBJECT", "MY_ARRAY", MyStruct{})

// Register with explicit owner
go_ora.RegisterTypeWithOwner(db, "SCHEMA", "MY_OBJECT", "MY_ARRAY", MyStruct{})

Supports nested objects, collections (VARRAY, TABLE OF), and automatic struct mapping via udt tags.

7. Session Parameters

Runtime session parameter management without reconnecting:

// Set session parameters
go_ora.AddSessionParam(db, "cursor_sharing", "force")
go_ora.AddSessionParam(db, "nls_language", "arabic")

// Parameters persist across connections in the pool
go_ora.DelSessionParam(db, "nls_language")
8. Custom Type Coders

Register custom encoders/decoders for new types:

go_ora.AddParameterCoder(db, reflect.TypeOf(MyType{}), MY_ORACLE_TYPE_ID, &MyCoder{})

Installation

go get github.com/sijms/go-ora/v3

Quick Start

import (
    "database/sql"
    _ "github.com/sijms/go-ora/v3"
)

func main() {
    db, err := sql.Open("oracle", "oracle://user:pass@host:1521/service")
    if err != nil {
        panic(err)
    }
    defer db.Close()

    err = db.Ping()
    if err != nil {
        panic(err)
    }
}

Connection String Options

Option Description
SERVER Database server hostname or IP
PORT Database port (default 1521)
SERVICE Oracle service name
USER Database username
PASSWORD Database password
SSL Enable SSL/TLS connection
SSL VERIFY Verify server certificate
WALLET Path to Oracle wallet
AUTH TYPE Authentication type (KERBEROS, etc.)
FAST LOGIN Enable fast login optimization
TOKEN FILE Path to authentication token file
TOKEN PRIVATE KEY FILE Path to token private key
TRACE DIR Directory for trace files
CONNECT TIMEOUT Connection timeout duration
LOB READ LOB read mode: AUTO or IMPLICIT (driver reads LOB automatically, default) or NO or EXPLICIT (manual LOB read by application)

Package Structure

go-ora/v3/
├── advanced_nego/     # Advanced authentication negotiation (NTS, Kerberos)
├── aq/                # Advanced Queuing (enqueue/dequeue)
├── configurations/    # Connection configuration parsing
├── converters/        # String and data converters
├── lazy_init/         # Lazy initialization utilities
├── network/           # TTC protocol, packets, session management
│   └── security/      # Security-related network utilities
├── parameter_coder/   # Parameter encoding/decoding implementations
├── trace/             # Trace and logging
├── types/             # Oracle type implementations
│   └── oson/          # Oracle Binary JSON (OSON) coder
├── utils/             # General utilities
├── connection.go      # Connection implementation
├── driver.go          # Driver registration and type coder maps
├── command.go         # Statement execution
├── parameter.go       # Parameter handling
├── lob.go             # LOB streaming
├── udt.go             # User-Defined Type support
├── transaction.go     # Transaction support
└── bulk_copy.go       # Bulk copy operations

Migration from v2

  1. Update import path: github.com/sijms/go-ora/v2github.com/sijms/go-ora/v3
  2. New types (Vector, Json, Bool) are in github.com/sijms/go-ora/v3/types
  3. AQ API changed from go_ora/dbms.NewAQ to aq.CreateQueue
  4. UDT registration uses go_ora.RegisterType with struct-based type mapping
  5. Session parameters managed via go_ora.AddSessionParam / go_ora.DelSessionParam
  6. Connection string format remains compatible

Documentation

Index

Constants

View Source
const (
	TNS_TYPE_REP_NATIVE    uint16 = 0
	TNS_TYPE_REP_UNIVERSAL uint16 = 1
	TNS_TYPE_REP_ORACLE    uint16 = 10
	TNS_DATA_TYPE_VBI      uint16 = 15
	TNS_DATA_TYPE_UB2      uint16 = 25
	TNS_DATA_TYPE_UB4      uint16 = 26
	TNS_DATA_TYPE_SB1      uint16 = 27
	TNS_DATA_TYPE_SB2      uint16 = 28
	TNS_DATA_TYPE_SB4      uint16 = 29
	TNS_DATA_TYPE_SWORD    uint16 = 30
	TNS_DATA_TYPE_UWORD    uint16 = 31
	TNS_DATA_TYPE_PTRB     uint16 = 32
	TNS_DATA_TYPE_PTRW     uint16 = 33
	TNS_DATA_TYPE_TIDDEF   uint16 = 10
	TNS_DATA_TYPE_CURSOR   uint16 = 102
	TNS_DATA_TYPE_RDD      uint16 = 104
	TNS_DATA_TYPE_CLOB     uint16 = 112
	TNS_DATA_TYPE_BLOB     uint16 = 113
	TNS_DATA_TYPE_BFILE    uint16 = 114
	TNS_DATA_TYPE_CFILE    uint16 = 115
	TNS_DATA_TYPE_RSET     uint16 = 116
	//TNS_DATA_TYPE_VECTOR    int16 = 127
	TNS_DATA_TYPE_DCLOB     uint16 = 195
	TNS_DATA_TYPE_DBLOB     uint16 = 196
	TNS_DATA_TYPE_DBFILE    uint16 = 197
	TNS_DATA_TYPE_UROWID    uint16 = 208
	TNS_DATA_TYPE_EXT_NAMED uint16 = 108
	TNS_DATA_TYPE_INT_NAMED uint16 = 109
	TNS_DATA_TYPE_EXT_REF   uint16 = 110
	TNS_DATA_TYPE_INT_REF   uint16 = 111
)

Variables

This section is empty.

Functions

func AddParameterCoder

func AddParameterCoder(db *sql.DB, go_type reflect.Type, oracle_type uint16, coder parameter_coder.OracleParameterCoder) error

func AddSessionParam

func AddSessionParam(db *sql.DB, key, value string) error

func BuildJDBC

func BuildJDBC(user, password, connStr string, options map[string]string) string

BuildJDBC create url from user, password and JDBC description string

func BuildUrl

func BuildUrl(server string, port int, service, user, password string, options map[string]string) string

BuildUrl create databaseURL from server, port, service, user, password, urlOptions this function help build a will formed databaseURL and accept any character as it convert special charters to corresponding values in URL

func DelSessionParam

func DelSessionParam(db *sql.DB, key string)

func NewBatch

func NewBatch(array driver.Value) driver.Value

func NewConnector

func NewConnector(connString string) driver.Connector

func ParseConfig

func ParseConfig(dsn string) (*configurations.ConnectionConfig, error)

func RegisterConnConfig

func RegisterConnConfig(config *configurations.ConnectionConfig)

func RegisterType

func RegisterType(db *sql.DB, typeName, arrayTypeName string, typeObj interface{}) error

func RegisterTypeWithOwner

func RegisterTypeWithOwner(db *sql.DB, owner, typeName, arrayTypeName string, typeObj interface{}) error

func SetNTSAuth

func SetNTSAuth(newNTSManager advanced_nego.NTSAuthInterface)

func SetStringConverter

func SetStringConverter(db GetDriverInterface, charset, nCharset converters.IStringConverter)

SetStringConverter this function is used to set a custom string converter interface that will be used to encode and decode strings and bytearrays passing nil will use driver string converter for supported langs

func TZBytes

func TZBytes() []byte

func WrapRefCursor

func WrapRefCursor(ctx context.Context, q Querier, cursor *RefCursor) (*sql.Rows, error)

Types

type AuthObject

type AuthObject struct {
	EServerSessKey string
	EClientSessKey string
	EPassword      string
	ESpeedyKey     string
	ServerSessKey  []byte
	ClientSessKey  []byte
	KeyHash        []byte
	Salt           string

	//customHash       bool
	VerifierType int
	// contains filtered or unexported fields
}

E infront of the variable means encrypted

func (*AuthObject) Write

func (obj *AuthObject) Write() error

write authentication data to network

type Connection

type Connection struct {
	State     ConnectionState
	LogonMode LogonMode

	SessionProperties map[string]string

	NLSData NLSData
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(databaseUrl string, config *configurations.ConnectionConfig) (*Connection, error)

NewConnection create a new connection from databaseURL string or configuration

func (*Connection) Begin

func (conn *Connection) Begin() (driver.Tx, error)

Begin a transaction

func (*Connection) BeginTx

func (conn *Connection) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)

func (*Connection) CheckNamedValue

func (conn *Connection) CheckNamedValue(nv *driver.NamedValue) error

func (*Connection) Close

func (conn *Connection) Close() (err error)

Close the connection by disconnect network session

func (*Connection) Exec

func (conn *Connection) Exec(text string, args ...driver.Value) (driver.Result, error)

func (*Connection) ExecContext

func (conn *Connection) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)

func (*Connection) GetDBServerTimeZone added in v3.0.1

func (conn *Connection) GetDBServerTimeZone() *time.Location

func (*Connection) GetDBTimeZone added in v3.0.1

func (conn *Connection) GetDBTimeZone() *time.Location

func (*Connection) GetDefaultStringCoder

func (conn *Connection) GetDefaultStringCoder() (converters.IStringConverter, error)

func (*Connection) GetMaxRawLength

func (conn *Connection) GetMaxRawLength() int64

func (*Connection) GetMaxStringLength

func (conn *Connection) GetMaxStringLength() int64

func (*Connection) GetNLS

func (conn *Connection) GetNLS() (*NLSData, error)

GetNLS return NLS properties of the connection. this function is left from v1. but v2 is using another method

func (*Connection) GetParameterCoder

func (conn *Connection) GetParameterCoder(input interface{}) (parameter_coder.OracleParameterCoder, error)

func (*Connection) GetServerNStringCoder

func (conn *Connection) GetServerNStringCoder() converters.IStringConverter

func (*Connection) GetServerStringCoder

func (conn *Connection) GetServerStringCoder() converters.IStringConverter

func (*Connection) GetSession

func (conn *Connection) GetSession() network.SessionReadWriter

func (*Connection) GetStringCoder

func (conn *Connection) GetStringCoder(charsetID, charsetForm int) (converters.IStringConverter, error)

func (*Connection) IsValid

func (conn *Connection) IsValid() bool

IsValid validates if a connection has to be discarded. Part of a keepConnOnRollback condition to decide if to keep a transaction after rollback.

func (*Connection) Logoff

func (conn *Connection) Logoff() error

func (*Connection) NewLobStreamer

func (conn *Connection) NewLobStreamer() types.LobStreamer

func (*Connection) Open

func (conn *Connection) Open() error

Open the connection = bring it online

func (*Connection) OpenWithContext

func (conn *Connection) OpenWithContext(ctx context.Context) error

OpenWithContext open the connection with timeout context

func (*Connection) Ping

func (conn *Connection) Ping(ctx context.Context) error

Ping test if connection is online

func (*Connection) Prepare

func (conn *Connection) Prepare(query string) (driver.Stmt, error)

Prepare take a query string and create a stmt object

func (*Connection) PrepareContext

func (conn *Connection) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)

func (*Connection) ProcessTCCResponse

func (conn *Connection) ProcessTCCResponse(msgCode uint8) error

func (*Connection) QueryContext

func (conn *Connection) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)

func (*Connection) QueryRowContext

func (conn *Connection) QueryRowContext(ctx context.Context, query string, args []driver.NamedValue) *DataSet

func (*Connection) ResetSession

func (conn *Connection) ResetSession(_ context.Context) error

ResetSession decides responsible for resetting a connection. Part of a keepConnOnRollback condition to decide if to keep a transaction after rollback.

func (*Connection) SendTimeAsUTC added in v3.0.1

func (conn *Connection) SendTimeAsUTC() bool

func (*Connection) TTCVersion

func (conn *Connection) TTCVersion() uint8

type ConnectionCookie

type ConnectionCookie struct {
	ServerCharset         int
	ServerFlags           uint8
	ServerNCharset        int
	OracleVersion         int
	ProtocolServerString  string
	ServerCompileTimeCaps []byte
	ServerRuntimeCaps     []byte
	// contains filtered or unexported fields
}

type ConnectionProperties

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

type ConnectionState

type ConnectionState int
const (
	Closed ConnectionState = 0
	Opened ConnectionState = 1
)

type DBVersion

type DBVersion struct {
	Info            string
	Text            string
	Number          uint16
	MajorVersion    int
	MinorVersion    int
	PatchsetVersion int
}

func GetDBVersion

func GetDBVersion(session *network.Session) (*DBVersion, error)

GetDBVersion write a request to get database version the read database version from network session

type DataSet

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

func (*DataSet) Close

func (dataSet *DataSet) Close() error

func (*DataSet) ColumnTypeDatabaseTypeName

func (dataSet *DataSet) ColumnTypeDatabaseTypeName(index int) string

ColumnTypeDatabaseTypeName return Col DataType name

func (*DataSet) ColumnTypeLength

func (dataSet *DataSet) ColumnTypeLength(index int) (int64, bool)

ColumnTypeLength return length of column type

func (*DataSet) ColumnTypeNullable

func (dataSet *DataSet) ColumnTypeNullable(index int) (nullable, ok bool)

ColumnTypeNullable return if column allow null or not

func (*DataSet) ColumnTypePrecisionScale

func (dataSet *DataSet) ColumnTypePrecisionScale(index int) (int64, int64, bool)

ColumnTypePrecisionScale return the precision and scale for numeric types

func (*DataSet) ColumnTypeScanType

func (dataSet *DataSet) ColumnTypeScanType(index int) reflect.Type

func (*DataSet) Columns

func (dataSet *DataSet) Columns() []string

Columns return a string array that represent columns names

func (*DataSet) Err

func (dataSet *DataSet) Err() error

func (*DataSet) HasNextResultSet

func (dataSet *DataSet) HasNextResultSet() bool

func (*DataSet) Next

func (dataSet *DataSet) Next(dest []driver.Value) error

Next implement method need for sql.Rows interface

func (*DataSet) NextResultSet

func (dataSet *DataSet) NextResultSet() error

func (*DataSet) Next_

func (dataSet *DataSet) Next_() bool

Next_ act like Next in sql package return false if no other rows in dataset

func (*DataSet) Scan

func (dataSet *DataSet) Scan(dest ...interface{}) error

Scan act like scan in sql package return row values to dest variable pointers

func (*DataSet) Trace

func (dataSet *DataSet) Trace(t trace.Tracer)

type DataTypeNego

type DataTypeNego struct {
	MessageCode        uint8
	Server             *TCPNego
	TypeAndRep         []uint16
	RuntimeTypeAndRep  []uint16
	DataTypeRepFor1100 uint16
	DataTypeRepFor1200 uint16
	CompileTimeCaps    []byte
	RuntimeCap         []byte
	// contains filtered or unexported fields
}

type GetDriverInterface

type GetDriverInterface interface {
	Driver() driver.Driver
}

type LobStream

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

func (*LobStream) Close

func (lob *LobStream) Close(opID int) error

func (*LobStream) CreateTemporaryLocator

func (lob *LobStream) CreateTemporaryLocator(charsetID, charsetForm int) (ora_types.Locator, error)

func (*LobStream) DatabaseVersionNumber

func (lob *LobStream) DatabaseVersionNumber() int

func (*LobStream) EndContext

func (lob *LobStream) EndContext(done chan struct{})

func (*LobStream) Exists

func (lob *LobStream) Exists() (bool, error)

func (*LobStream) FreeTemporaryLocator

func (lob *LobStream) FreeTemporaryLocator() error

func (*LobStream) GetLobId

func (lob *LobStream) GetLobId() []byte

func (*LobStream) GetLobReadMode

func (lob *LobStream) GetLobReadMode() configurations.LobReadMode

func (*LobStream) GetLobStreamMode

func (lob *LobStream) GetLobStreamMode() configurations.LobFetch

func (*LobStream) GetLocator

func (lob *LobStream) GetLocator() ora_types.Locator

func (*LobStream) GetSize

func (lob *LobStream) GetSize() (size int64, err error)

getSize return lob size

func (*LobStream) GetStringCoder

func (lob *LobStream) GetStringCoder() converters.StringCoder

func (*LobStream) GetTracer

func (lob *LobStream) GetTracer() trace.Tracer

func (*LobStream) Open

func (lob *LobStream) Open(mode, opID int) error

func (*LobStream) Read

func (lob *LobStream) Read(offset, count int64) (data []byte, err error)

func (*LobStream) SetLocator

func (lob *LobStream) SetLocator(locator ora_types.Locator)

func (*LobStream) StartContext

func (lob *LobStream) StartContext(ctx context.Context) chan struct{}

isTemporary: return true if the lob is temporary

func (lob *LobStream) isTemporary() bool {
	if len(lob.sourceLocator) > 7 {
		if lob.sourceLocator[7]&1 == 1 || lob.sourceLocator[4]&0x40 == 0x40 || lob.isValueBasedLocator() {
			return true
		}
	}
	return false
}

func (lob *LobStream) isQuasiLocator() bool {
	return lob.sourceLocator.IsQuasi()
}

func (lob *LobStream) isValueBasedLocator() bool {
	return lob.sourceLocator[4]&0x20 > 0
}

func (*LobStream) Write

func (lob *LobStream) Write(data []byte) error

type LogonMode

type LogonMode int
const (
	NoNewPass   LogonMode = 0x1
	SysDba      LogonMode = 0x20
	SysOper     LogonMode = 0x40
	SysAsm      LogonMode = 0x00400000
	SysBackup   LogonMode = 0x01000000
	SysDg       LogonMode = 0x02000000
	SysKm       LogonMode = 0x04000000
	SysRac      LogonMode = 0x08000000
	UserAndPass LogonMode = 0x100
	WithNewPass LogonMode = 0x2
	PROXY       LogonMode = 0x400
)

type NLSData

type NLSData struct {
	Calender        string `db:"p_nls_calendar,,40,out"`
	Comp            string `db:"p_nls_comp,,40,out"`
	Language        string
	LengthSemantics string `db:"p_nls_length_semantics,,40,out"`
	NCharConvExcep  string `db:"p_nls_nchar_conv_excep,,40,out"`
	NCharConvImp    string
	DateLang        string `db:"p_nls_date_lang,,40,out"`
	Sort            string `db:"p_nls_sort,,40,out"`
	Currency        string `db:"p_nls_currency,,40,out"`
	DateFormat      string `db:"p_nls_date_format,,40,out"`
	TimeFormat      string
	IsoCurrency     string `db:"p_nls_iso_currency,,40,out"`
	NumericChars    string `db:"p_nls_numeric_chars,,40,out"`
	DualCurrency    string `db:"p_nls_dual_currency,,40,out"`
	UnionCurrency   string
	Timestamp       string `db:"p_nls_timestamp,,48,out"`
	TimestampTZ     string `db:"p_nls_timestamp_tz,,56,out"`
	TTimezoneFormat string
	NTimezoneFormat string
	Territory       string
	Charset         string
}

func (*NLSData) SaveNLSValue

func (nls *NLSData) SaveNLSValue(key, value string, code int)

SaveNLSValue a helper function that convert between nls key and code

type NullTimeStampTZ

type NullTimeStampTZ struct {
	TimeStampTZ TimeStampTZ
	Valid       bool
}

func (NullTimeStampTZ) MarshalJSON

func (val NullTimeStampTZ) MarshalJSON() ([]byte, error)

func (*NullTimeStampTZ) Scan

func (val *NullTimeStampTZ) Scan(value interface{}) error

func (*NullTimeStampTZ) UnmarshalJSON

func (val *NullTimeStampTZ) UnmarshalJSON(data []byte) error

func (NullTimeStampTZ) Value

func (val NullTimeStampTZ) Value() (driver.Value, error)

type ObjectParameter

type ObjectParameter struct {
	parameter_coder.BasicParameter
	// contains filtered or unexported fields
}

func (*ObjectParameter) Copy

func (*ObjectParameter) Decode

func (param *ObjectParameter) Decode(conn parameter_coder.IConnection) (interface{}, error)

func (*ObjectParameter) Encode

func (param *ObjectParameter) Encode(input interface{}, conn parameter_coder.IConnection) (err error)
func (param *ObjectParameter) encodeObject(input interface{}, conn parameter_coder.IConnection) (err error) {
	return
}

func (param *ObjectParameter) encodeArray(input interface{}, conn parameter_coder.IConnection) (err error) {

}

func (*ObjectParameter) Init

func (param *ObjectParameter) Init()

func (*ObjectParameter) Read

func (param *ObjectParameter) Read(session network.SessionReader) error

func (*ObjectParameter) Write

func (param *ObjectParameter) Write(session network.SessionWriter) error

type OracleConnector

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

func (*OracleConnector) Connect

func (connector *OracleConnector) Connect(ctx context.Context) (driver.Conn, error)

func (*OracleConnector) Dialer

func (connector *OracleConnector) Dialer(dialer configurations.DialerContext)

func (*OracleConnector) Driver

func (connector *OracleConnector) Driver() driver.Driver

func (*OracleConnector) WithKerberosAuth

func (connector *OracleConnector) WithKerberosAuth(auth configurations.KerberosAuthInterface)

WithKerberosAuth sets the Kerberos authenticator to be used by this connector. It does not enable the Kerberos; set AUTH TYPE to KERBEROS to do so.

func (*OracleConnector) WithTLSConfig

func (connector *OracleConnector) WithTLSConfig(config *tls.Config)

func (*OracleConnector) WithWallet

func (connector *OracleConnector) WithWallet(reader io.Reader) error

type OracleDriver

type OracleDriver struct {
	UserId string
	// contains filtered or unexported fields
}

func GetDefaultDriver

func GetDefaultDriver() *OracleDriver

func NewDriver

func NewDriver() *OracleDriver

func (*OracleDriver) Open

func (driver *OracleDriver) Open(name string) (driver.Conn, error)

Open return a new open connection

func (*OracleDriver) OpenConnector

func (driver *OracleDriver) OpenConnector(connString string) (driver.Connector, error)

type Out

type Out struct {
	Dest driver.Value
	Size int
	In   bool
}

type ParameterDirection

type ParameterDirection int
const (
	Input  ParameterDirection = 1
	Output ParameterDirection = 2
	InOut  ParameterDirection = 3
)

type ParameterInfo

type ParameterInfo struct {
	Name         string
	SchemaName   string
	DomainSchema string
	DomainName   string
	Direction    ParameterDirection
	IsNull       bool
	AllowNull    bool
	IsJson       bool
	ColAlias     string
	IsXmlType    bool
	Precision    uint8
	Scale        uint8

	Value driver.Value

	Annotations map[string]string
	parameter_coder.BasicParameter
	// contains filtered or unexported fields
}

type Querier

type Querier interface {
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
}

Querier is the QueryContext of sql.Conn.

type QueryResult

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

func (*QueryResult) LastInsertId

func (rs *QueryResult) LastInsertId() (int64, error)

func (*QueryResult) RowsAffected

func (rs *QueryResult) RowsAffected() (int64, error)

type RefCursor

type RefCursor struct {
	MaxRowSize int
	// contains filtered or unexported fields
}

func (*RefCursor) CanAutoClose

func (stmt *RefCursor) CanAutoClose() bool

func (*RefCursor) Close

func (stmt *RefCursor) Close() error

Close stmt cursor in the server

func (*RefCursor) Query

func (cursor *RefCursor) Query() (*DataSet, error)

func (RefCursor) SetDataType

func (cursor RefCursor) SetDataType(conn *Connection, par *ParameterInfo) error

type ResultSet

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

func (*ResultSet) Close

func (resultSet *ResultSet) Close() error

func (*ResultSet) ColumnTypeDatabaseTypeName

func (resultSet *ResultSet) ColumnTypeDatabaseTypeName(index int) string

ColumnTypeDatabaseTypeName return Col DataType name

func (*ResultSet) ColumnTypeLength

func (resultSet *ResultSet) ColumnTypeLength(index int) (int64, bool)

ColumnTypeLength return length of column type

func (*ResultSet) ColumnTypeNullable

func (resultSet *ResultSet) ColumnTypeNullable(index int) (nullable, ok bool)

ColumnTypeNullable return if column allow null or not

func (*ResultSet) ColumnTypePrecisionScale

func (resultSet *ResultSet) ColumnTypePrecisionScale(index int) (int64, int64, bool)

ColumnTypePrecisionScale return the precision and scale for numeric types

func (*ResultSet) ColumnTypeScanType

func (resultSet *ResultSet) ColumnTypeScanType(index int) reflect.Type

func (*ResultSet) Columns

func (resultSet *ResultSet) Columns() []string

func (*ResultSet) Err

func (resultSet *ResultSet) Err() error

func (*ResultSet) Next

func (resultSet *ResultSet) Next(dest []driver.Value) error

Next implement method need for sql.Rows interface

func (*ResultSet) Next_

func (resultSet *ResultSet) Next_() bool

Next_ act like Next in sql package return false if no other rows in dataset

func (*ResultSet) Scan

func (resultSet *ResultSet) Scan(dest ...interface{}) error

Scan act like scan in sql package return row values to dest variable pointers

func (*ResultSet) Trace

func (resultSet *ResultSet) Trace(t trace.Tracer)

type Row

type Row []driver.Value

type Stmt

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

func NewStmt

func NewStmt(text string, conn *Connection) *Stmt

NewStmt create new stmt and set its connection properties

func (*Stmt) CanAutoClose

func (stmt *Stmt) CanAutoClose() bool

func (*Stmt) CheckNamedValue

func (stmt *Stmt) CheckNamedValue(nv *driver.NamedValue) error

func (*Stmt) Close

func (stmt *Stmt) Close() error

Close stmt cursor in the server

func (*Stmt) Exec

func (stmt *Stmt) Exec(args []driver.Value) (driver.Result, error)

Exec execute stmt (INSERT, UPDATE, DELETE, DML, PLSQL) and return driver.Result object

func (*Stmt) ExecContext

func (stmt *Stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)

func (*Stmt) NewParam

func (stmt *Stmt) NewParam(name string, val driver.Value, size int, direction ParameterDirection) (*ParameterInfo, error)

func (*Stmt) NumInput

func (stmt *Stmt) NumInput() int

func (*Stmt) Query

func (stmt *Stmt) Query(args []driver.Value) (driver.Rows, error)

Query execute a query command and return dataset object in form of driver.Rows interface

args is an array of values that corresponding to parameters in sql

func (*Stmt) QueryContext

func (stmt *Stmt) QueryContext(ctx context.Context, namedArgs []driver.NamedValue) (driver.Rows, error)

func (*Stmt) Query_

func (stmt *Stmt) Query_(namedArgs []driver.NamedValue) (*DataSet, error)

Query_ execute a query command and return oracle dataset object

args is an array of values that corresponding to parameters in sql

type StmtInterface

type StmtInterface interface {
	Close() error
	CanAutoClose() bool
	// contains filtered or unexported methods
}

type StmtType

type StmtType int
const (
	SELECT StmtType = 1
	DML    StmtType = 2
	PLSQL  StmtType = 3
	OTHERS StmtType = 4
)

type TCPNego

type TCPNego struct {
	MessageCode           uint8
	ProtocolServerString  string
	OracleVersion         int
	ServerCharset         int
	ServerFlags           uint8
	ServerNCharset        int
	ServerCompileTimeCaps []byte
	ServerRuntimeCaps     []byte
	// contains filtered or unexported fields
}

type TimeStampTZ

type TimeStampTZ time.Time

func (TimeStampTZ) MarshalJSON

func (val TimeStampTZ) MarshalJSON() ([]byte, error)

func (*TimeStampTZ) Scan

func (val *TimeStampTZ) Scan(value interface{}) error

func (*TimeStampTZ) UnmarshalJSON

func (val *TimeStampTZ) UnmarshalJSON(data []byte) error

func (*TimeStampTZ) Value

func (val *TimeStampTZ) Value() (driver.Value, error)

type Transaction

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

func (*Transaction) Commit

func (tx *Transaction) Commit() error

func (*Transaction) Rollback

func (tx *Transaction) Rollback() error

Directories

Path Synopsis
ntlmssp
Package ntlmssp provides NTLM/Negotiate authentication over HTTP
Package ntlmssp provides NTLM/Negotiate authentication over HTTP
generatefloat command
security/md4
Package md4 implements the MD4 hash algorithm as defined in RFC 1320.
Package md4 implements the MD4 hash algorithm as defined in RFC 1320.

Jump to

Keyboard shortcuts

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