squirrel_sqlx

package module
v0.0.0-...-fe99656 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 7 Imported by: 0

README

squirrel_sqlx

squirrel作为sql构建器,sqlx执行并扫描结果

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(conf *Database) error

func SetLogHook

func SetLogHook(hook func(ctx context.Context, sqlStr string, args []any))

Types

type Database

type Database struct {
	Host string `yaml:"host"`
	Port string `yaml:"port"`
	User string `yaml:"user"`
	Pwd  string `yaml:"pwd"`
	Name string `yaml:"name"`
	Dsn  string `yaml:"dsn"`
}

type Scanner

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

Scanner 执行sql并扫描结果

func NewScanner

func NewScanner(ctx context.Context) *Scanner

func (*Scanner) Scan

func (s *Scanner) Scan(sql squirrel.Sqlizer, dest interface{}) error

Scan 扫描结果

func (*Scanner) WithDB

func (s *Scanner) WithDB(db *sqlx.DB) *Scanner

func (*Scanner) WithLogHook

func (s *Scanner) WithLogHook(hook func(sqlStr string, args []any)) *Scanner

WithLogHook 输出sql日志hook

Jump to

Keyboard shortcuts

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