oracle

package
v2.0.0-...-8094968 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package oracle implements gdb.Driver, which supports operations for Oracle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() gdb.Driver

New create and returns a driver that implements gdb.Driver, which supports operations for Oracle.

Types

type DriverOracle

type DriverOracle struct {
	*gdb.Core
}

DriverOracle is the driver for oracle database.

func (*DriverOracle) DoFilter

func (d *DriverOracle) DoFilter(ctx context.Context, link gdb.Link, sql string, args []interface{}) (newSql string, newArgs []interface{}, err error)

DoFilter deals with the sql string before commits it to underlying sql driver.

func (*DriverOracle) DoInsert

func (d *DriverOracle) DoInsert(
	ctx context.Context, link gdb.Link, table string, list gdb.List, option gdb.DoInsertOption,
) (result sql.Result, err error)

DoInsert inserts or updates data for given table. This function is usually used for custom interface definition, you do not need call it manually. The parameter `data` can be type of map/gmap/struct/*struct/[]map/[]struct, etc. Eg: Data(g.Map{"uid": 10000, "name":"john"}) Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})

The parameter `option` values are as follows: 0: insert: just insert, if there's unique/primary key in the data, it returns error; 1: replace: if there's unique/primary key in the data, it deletes it from table and inserts a new one; 2: save: if there's unique/primary key in the data, it updates it or else inserts a new one; 3: ignore: if there's unique/primary key in the data, it ignores the inserting;

func (d *DriverOracle) FilteredLink() string

FilteredLink retrieves and returns filtered `linkInfo` that can be using for logging or tracing purpose.

func (*DriverOracle) GetChars

func (d *DriverOracle) GetChars() (charLeft string, charRight string)

GetChars returns the security char for this type of database.

func (*DriverOracle) New

func (d *DriverOracle) New(core *gdb.Core, node *gdb.ConfigNode) (gdb.DB, error)

New creates and returns a database object for oracle. It implements the interface of gdb.Driver for extra database driver installation.

func (*DriverOracle) Open

func (d *DriverOracle) Open(config *gdb.ConfigNode) (db *sql.DB, err error)

Open creates and returns an underlying sql.DB object for oracle.

func (*DriverOracle) TableFields

func (d *DriverOracle) TableFields(
	ctx context.Context, table string, schema ...string,
) (fields map[string]*gdb.TableField, err error)

TableFields retrieves and returns the fields' information of specified table of current schema.

Also see DriverMysql.TableFields.

func (*DriverOracle) Tables

func (d *DriverOracle) Tables(ctx context.Context, schema ...string) (tables []string, err error)

Tables retrieves and returns the tables of current schema. It's mainly used in cli tool chain for automatically generating the models. Note that it ignores the parameter `schema` in oracle database, as it is not necessary.

Jump to

Keyboard shortcuts

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