mssql

package
v2.0.0-...-172f5c6 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DriverName godbv2.DriverName = "mssql"
View Source
const EmptyUniqueidentifier = "00000000-0000-0000-0000-000000000000"

EmptyUniqueidentifier 空的uniqueidentifier值

Variables

This section is empty.

Functions

func UniqueidentifierValue

func UniqueidentifierValue(val string) sql.NullString

UniqueidentifierValue 创建一个uniqueidentifier值,当可能是null的时候用

Types

type MSSQL

type MSSQL struct {
	godbv2.Connect
	// contains filtered or unexported fields
}

MSSQL 操作对象

func Connect

func Connect(host, username, password, db string, params ...url.Values) (*MSSQL, error)

Connect 链接mssql数据库

func (*MSSQL) Close

func (m *MSSQL) Close()

func (*MSSQL) Exec

func (m *MSSQL) Exec(sql string, args ...any) *godbv2.ExecResult

func (*MSSQL) Prepare

func (m *MSSQL) Prepare(query string) (*sql.Stmt, error)

func (*MSSQL) QueryRow

func (m *MSSQL) QueryRow(sql string, args ...any) *godbv2.QueryResult

func (*MSSQL) QueryRows

func (m *MSSQL) QueryRows(sql string, args ...any) *godbv2.QueryResult

func (*MSSQL) QueryWithPage

func (m *MSSQL) QueryWithPage(sql string, page *godbv2.PageObj, args ...interface{}) *godbv2.QueryResult

func (*MSSQL) SetConn

func (m *MSSQL) SetConn(conn godbv2.QueryWithContext)

func (*MSSQL) Transaction

func (m *MSSQL) Transaction(t godbv2.TransactionFunc, option ...*sql.TxOptions) error

type SQLPrinter

type SQLPrinter struct {
	Message    []string `description:"输出的内容"`
	ErrMessage string   `description:"输出的错误"`
	// contains filtered or unexported fields
}

SQLPrinter sql服务输出的消息,MSSQL支持 使用方法:

	printer := &SQLPrinter{}
	res := conn.QueryRows(sql,args1,arg2,printer.ReturnMessage())
 	printer.Parse()
	fmt.Printf("Print: %v\n",printer.Message)
	fmt.Printf("Error: %s\n",printer.ErrMessage)
	fmt.Printf("Rows: %d\n,res.Length())

func (*SQLPrinter) Parse

func (s *SQLPrinter) Parse()

Parse 解析消息

func (*SQLPrinter) ReturnMessage

func (s *SQLPrinter) ReturnMessage() *sqlexp.ReturnMessage

Jump to

Keyboard shortcuts

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