mysql

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: ISC Imports: 7 Imported by: 0

Documentation

Overview

Package mysql is meta.Metadata on top of MySQL 8 (go-mysql-org/go-mysql: pure Go and the protocol fields in full: flags, charset, length, which database/sql does not expose).

It mirrors Connector/J 8.4 with default settings (client-side prepare):

  • result columns are found out by running the query with NULL instead of '?' and a limit of one row; non-SELECT statements (INSERT, UPDATE, ...) have no metadata;
  • CALL is executed too (Connector/J does so), here in a transaction that is rolled back;
  • parameter types are java.lang.Object, except for CALL: a procedure declares them;
  • tables, keys and indexes come from information_schema of the current database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnParams

func ConnParams(jdbcURL, user, pwd string) (addr, db, u, p string, err error)

ConnParams returns the address, database, user and password from jdbc:mysql://host[:port]/db or mysql://...

Types

type DB

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

func Open

func Open(addr, db, user, pwd string) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) Exec

func (db *DB) Exec(sql string) error

Exec is for setting up the schema in dumps.

func (*DB) IdentifierQuote added in v1.1.2

func (db *DB) IdentifierQuote() string

IdentifierQuote: as getIdentifierQuoteString of Connector/J.

func (*DB) ImportedKeys

func (db *DB) ImportedKeys(table string) ([]meta.ImportedKey, error)

func (*DB) PKColNames

func (db *DB) PKColNames(tableRef string) ([]string, error)

func (*DB) RawOfJava

func (db *DB) RawOfJava(javaType string) string

func (*DB) SQLColumns

func (db *DB) SQLColumns(jdbcSQL string) ([]meta.Column, error)

func (*DB) SQLParams

func (db *DB) SQLParams(jdbcSQL string, typeCount int) (*meta.Params, error)

func (*DB) Table

func (db *DB) Table(tableRef string) (*meta.Table, error)

func (*DB) Tables

func (db *DB) Tables(includeViews bool) ([]string, error)

Tables: as Connector/J getTables on the current database: BASE TABLE before VIEW, then by name.

Jump to

Keyboard shortcuts

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