database

package
v0.0.0-...-f25a7fe Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	ColumnName    string `db:"COLUMN_NAME"`
	IsNullable    string `db:"IS_NULLABLE"`
	ColumnDefault string `db:"COLUMN_DEFAULT"`
	DataType      string `db:"DATA_TYPE"`
}

Column struct

type Column struct {
	Column     string `db:"CL"`
	ColumnName string `db:"CN"`
	DataType   string `db:"DT"`
}

type Conn

type Conn struct {
	Source  *Database
	Dest    *Database
	SSchema string
	DSchema string
}

Conn struct

func (c *Conn) GenLink(table string, cols []Column, pkey []PKey) (sqld, sqlc string)

GenLink generate table creation

func (*Conn) GenTableIndexSQL

func (c *Conn) GenTableIndexSQL(tableName string) (sqld, sqlc string)

GenTableIndexSQL generate table index sql

func (*Conn) GenTables

func (c *Conn) GenTables(table string, cols []Column, pkey []PKey) (sqld, sqlc string)

GenTable generate table creation

func (*Conn) GenUpdate

func (c *Conn) GenUpdate(table string, cols []Column, pkey []PKey) (sqld, sqlc string)

GenUpdate generate update procedure

func (*Conn) GetColumnDetail

func (c *Conn) GetColumnDetail(t string, timeout int) ([]Column, error)

func (*Conn) GetForeignTableSchema

func (c *Conn) GetForeignTableSchema(table string, timeout int) (sqld, sqlc string)

GetForeignTableSchema gets table definition

func (*Conn) GetIndexSchema

func (c *Conn) GetIndexSchema(schema, index string) (Index, error)

GetIndexeschema returns Indexes and definition

func (*Conn) GetIndexes

func (c *Conn) GetIndexes(schema string, timeout int) ([]IndexList, error)

GetIndexes returns list of Indexes and definitions

func (*Conn) GetPKey

func (c *Conn) GetPKey(table string, timeout int) ([]PKey, error)

GetPKey func

func (*Conn) GetRoutineSchema

func (c *Conn) GetRoutineSchema(schema, routine string) (Routine, error)

GetRoutineSchema returns routine and definition

func (*Conn) GetRoutines

func (c *Conn) GetRoutines(schema string, timeout int) ([]RoutineList, error)

GetRoutines returns list of routines and definitions

func (*Conn) GetTableIndexSchema

func (c *Conn) GetTableIndexSchema(table string) ([]Index, error)

GetIndexeschema returns Indexes and definition

func (*Conn) GetTableSchema

func (c *Conn) GetTableSchema(table string, timeout int) (sqld, sqlc, sqldi, sqlci string)

GetTableSchema gets table definition

func (*Conn) GetTables

func (c *Conn) GetTables(schemaName, ttype string, timeout int) ([]Table, error)

GetTableList returns table list

func (*Conn) GetUpdateTableSchema

func (c *Conn) GetUpdateTableSchema(table string, timeout int) (sqld, sqlc string)

GetUpdateTableSchema gets table definition

func (*Conn) GetView

func (c *Conn) GetView(d Database, schema string, view View, dbg bool)

GetView gets view definition

func (*Conn) GetViewSchema

func (c *Conn) GetViewSchema(schema, view string) (View, error)

GetViewSchema returns views and definition

func (*Conn) GetViews

func (c *Conn) GetViews(schema string, timeout int) ([]ViewList, error)

GetViews returns list of views and definitions

type Database

type Database struct {
	Name     string `json:"name,omitempty"`
	Hostname string `json:"hostname,omitempty"`
	Port     int    `json:"port,omitempty"`
	Driver   string `json:"driver,omitempty"`
	Database string `json:"database,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	URI      string `json:"uri,omitempty"`
	*sqlx.DB
}

Database struct contains sql pointer

func OpenDatabase

func OpenDatabase(db Database) (*Database, error)

OpenDatabase open database

func (*Database) ExecProcedure

func (db *Database) ExecProcedure(q string)

ExecProcedure executes stored procedure

func (*Database) GetRoutine

func (db *Database) GetRoutine(d Database, schema string, r Routine, dbg bool)

GetRoutine gets procedure definition

func (*Database) GetSchemas

func (db *Database) GetSchemas(timeout int) ([]Schema, error)

GetSchemas returns schema list

func (*Database) GetTableIndexSchema

func (db *Database) GetTableIndexSchema(schema, table string) ([]Index, error)

func (*Database) GetURI

func (db *Database) GetURI()

GenURI generate db uri string

type Index

type Index struct {
	Schema     string `db:"schemaname"`
	Table      string `db:"tablename"`
	Name       string `db:"indexname"`
	Columns    string `db:"indexcolumns"`
	Definition string `db:"indexdef"`
}

Index list of Indexes

type IndexList

type IndexList struct {
	Name string `db:"indexname"`
}

type PKey

type PKey struct {
	PKey string `db:"CL"`
}

PKey struct

type Routine

type Routine struct {
	Name             string `db:"ROUTINE_NAME"`
	Type             string `db:"ROUTINE_TYPE"`
	Definition       string `db:"ROUTINE_DEFINITION"`
	DataType         string `db:"DATA_TYPE"`
	ExternalLanguage string `db:"EXTERNAL_LANGUAGE"`
}

Routine list of routines (procedures, functions)

type RoutineList

type RoutineList struct {
	Name string `db:"ROUTINE_NAME"`
}

type Schema

type Schema struct {
	Name string `db:"SCHEMA_NAME"`
}

Schema struct to hold schemas

type Table

type Table struct {
	Name string `db:"TABLE_NAME"`
}

Table list of tables

type View

type View struct {
	Name       string `db:"TABLE_NAME"`
	Definition string `db:"VIEW_DEFINITION"`
}

View list of views

type ViewList

type ViewList struct {
	Name string `db:"TABLE_NAME"`
}

Jump to

Keyboard shortcuts

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