data

package
v0.0.0-...-ab943b8 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DB_MAX_WORKER = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Conn      *sql.DB
	Chan      chan DBMessage
	AsyncChan chan DBInsert

	CurChanNum uint64

	MsgList *list.List
}

DB 数据库访问对象

func GetDB

func GetDB() *DB

GetDB 获取数据库访问服务

func (*DB) Execute

func (o *DB) Execute(sql string, args ...interface{}) error

Execute 执行SQL语句

func (*DB) Init

func (o *DB) Init() error

Init 初始化数据库

func (*DB) Worker

func (o *DB) Worker(ch <-chan DBMessage, ach <-chan DBInsert, proc int)

Worker 工作线程

type DBInsert

type DBInsert struct {
	SQL  string
	Args []interface{}
}

type DBMessage

type DBMessage struct {
	SQL  string
	Args []interface{}
	Dest []interface{}
	ReCh chan error
}

Jump to

Keyboard shortcuts

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