util

package
v0.0.0-...-89bbdfb Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: Apache-2.0, BSD-3-Clause, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BtUnknown BindType = iota
	BtAt
	BtColon
	BtDollar
	BtQuestion

	DbUnknown DbType = iota
	DbMySql
	DbOracle
	DbPostgres
	DbSQLite
	DbSqlServer
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BindType

type BindType int8

type DbHelper

type DbHelper interface {
	DbType() DbType
	BindType() BindType
	ToSQLStatementVal(val interface{}) string
	GetScanType(columnType *sql.ColumnType) interface{}
}

func GetDbHelper

func GetDbHelper(typeStr string) (DbHelper, error)

type DbType

type DbType int8

func ToDbType

func ToDbType(typeStr string) (DbType, error)

ToTypeEnum get the data type that corresponds to the specified name

type Part

type Part interface {
	ToValue(helper DbHelper, params map[string]interface{}) string
	Placeholder() string
	String() string
}

type SQLStatement

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

SQLStatement is a parsed DML SQL Statement

func NewSQLStatement

func NewSQLStatement(dbHelper DbHelper, sql string) (*SQLStatement, error)

func (*SQLStatement) GetPreparedStatementArgs

func (s *SQLStatement) GetPreparedStatementArgs(params map[string]interface{}) []interface{}

func (*SQLStatement) GetStatementArgs

func (s *SQLStatement) GetStatementArgs(params map[string]interface{}) []interface{}

func (*SQLStatement) HasParams

func (s *SQLStatement) HasParams() bool

func (*SQLStatement) PreparedStatementSQL

func (s *SQLStatement) PreparedStatementSQL() string

func (*SQLStatement) String

func (s *SQLStatement) String() string

func (*SQLStatement) ToStatementSQL

func (s *SQLStatement) ToStatementSQL(params map[string]interface{}) string

func (*SQLStatement) Type

func (s *SQLStatement) Type() StmtType

type StmtType

type StmtType int8
const (
	StUnknown StmtType = iota
	StSelect
	StInsert
	StUpdate
	StDelete
)

func ToStmtType

func ToStmtType(typeStr string) (StmtType, error)

ToTypeEnum get the data type that corresponds to the specified name

Jump to

Keyboard shortcuts

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