Help us shape the future of Go! Take the 2026 Go Developer Survey

mssql

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: 10 Imported by: 0

Documentation

Overview

Package mssql is meta.Metadata on top of microsoft/go-mssqldb. Queries are not executed: result columns come from sp_describe_first_result_set and parameters from sp_describe_undeclared_parameters (procedures: their parameters), the rest from the sys catalog by the rules of mssql-jdbc DatabaseMetaData, to match the Java plug-in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnString

func ConnString(dbURL, user, pwd string) (string, error)

ConnString returns the connection string of go-mssqldb for <db url user pwd>. Both forms are accepted:

  • go-mssqldb: sqlserver://host:1433?database=Northwind (instance: sqlserver://host/SQLEXPRESS);
  • JDBC (with or without "jdbc:"): sqlserver://host:1433;databaseName=Northwind;encrypt=false (instance: host\SQLEXPRESS or instanceName=SQLEXPRESS; integratedSecurity=true: Windows login).

Credentials in the URL take precedence over user and pwd.

Types

type DB

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

func Open

func Open(connString string) (*DB, error)

Open connects by a go-mssqldb connection string: sqlserver://user:password@host:1433?database=name.

func (*DB) Close

func (db *DB) Close() error

func (*DB) Exec

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

Exec is for setting up the schema in dumps.

func (*DB) IdentifierQuote

func (db *DB) IdentifierQuote() string

IdentifierQuote: [] of SQL Server (meta.QuoteName), not the " of getIdentifierQuoteString.

func (*DB) ImportedKeys

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

ImportedKeys: getImportedKeys of the table: by PK schema and table, then key order.

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 mssql-jdbc getTables with no schema: all schemas but sys and INFORMATION_SCHEMA, no objects shipped by Microsoft, tables before views, then by schema and name.

Jump to

Keyboard shortcuts

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