oracle

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

README


title: 'Oracle Database'

Oracle Database connector allows querying Oracle databases using pure Go implementation without requiring Oracle Instant Client.

Config Schema

Field Type Required Description
type string yes constant: oracle
hosts string[] yes List of server addresses (e.g., ["localhost", "oracle.example.com"])
user string yes Username for database authentication
password string yes Password for database authentication
database string yes Service name or SID
schema string yes Schema name (e.g., "HR", "SYSTEM")
port integer yes Port number (default: 1521)
conn_string string no Direct connection string

Config example:

type: oracle
hosts:
  - localhost
user: system
password: secretpassword
database: FREEPDB1
schema: HR
port: 1521

Or as alternative with direct connection string:

type: oracle
conn_string: oracle://system:secretpassword@localhost:1521/FREEPDB1

Notes

  • The connector uses the first host in the list by default. Additional hosts can be specified for future failover implementation.
  • The schema parameter is required and specifies the default schema for queries.
  • The database parameter should be your Oracle service name or SID.
  • The connector uses go-ora driver which is a pure Go implementation, no Oracle Instant Client required.
  • When using named parameters in queries, they will be automatically converted to numbered parameters (:1, :2, etc.) as required by Oracle.
  • For pagination, use Oracle's OFFSET ... ROWS FETCH NEXT ... ROWS ONLY syntax.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConnType   string   `yaml:"type"`
	Hosts      []string `yaml:"hosts"`
	User       string   `yaml:"user"`
	Password   string   `yaml:"password"`
	Database   string   `yaml:"database"`
	Schema     string   `yaml:"schema"`
	Port       int      `yaml:"port"`
	ConnString string   `yaml:"conn_string"`
	IsReadonly bool     `yaml:"is_readonly"`
}

Config holds the configuration for Oracle database connection

func (Config) ConnectionString

func (c Config) ConnectionString() string

ConnectionString builds Oracle connection string

func (Config) Doc

func (c Config) Doc() string

Doc returns documentation for the Oracle configuration

func (Config) ExtraPrompt

func (c Config) ExtraPrompt() []string

ExtraPrompt implements the connectors.Config interface

func (Config) GetType

func (c Config) GetType() string

Type implements the connectors.Config interface

func (Config) Readonly added in v0.2.1

func (c Config) Readonly() bool

func (Config) Type

func (c Config) Type() string

Type implements the connectors.Config interface

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface to allow for both direct connection string or full configuration objects in YAML

func (Config) Validate

func (c Config) Validate() error

Validate implements the connectors.Config interface

type Connector

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

Connector implements the connectors.Connector interface for Oracle Database

func (Connector) Config

func (c Connector) Config() connectors.Config

func (Connector) Discovery

func (c Connector) Discovery(ctx context.Context, tablesList []string) ([]model.Table, error)

func (*Connector) GuessColumnType

func (c *Connector) GuessColumnType(sqlType string) model.ColumnType

GuessColumnType implements TypeGuesser interface for Oracle

func (*Connector) InferQuery

func (c *Connector) InferQuery(ctx context.Context, query string) ([]model.ColumnSchema, error)

InferQuery implements the Connector interface

func (Connector) LoadsColumns

func (c Connector) LoadsColumns(ctx context.Context, tableName string) ([]model.ColumnSchema, error)

func (Connector) Ping

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

func (Connector) Query

func (c Connector) Query(ctx context.Context, endpoint model.Endpoint, params map[string]any) ([]map[string]any, error)

func (Connector) Sample

func (c Connector) Sample(ctx context.Context, table model.Table) ([]map[string]any, error)

Jump to

Keyboard shortcuts

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