当前位置: 首页>>代码示例>>Golang>>正文


Golang autorc.New函数代码示例

本文整理汇总了Golang中github.com/ziutek/mymysql/autorc.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: initializeForStorageProvider

func initializeForStorageProvider(parameter MysqlParameter) error {
	mysqlServerAddr := fmt.Sprintf("%v:%v", parameter.Ip, parameter.Port)
	Logger().Infof("Initialize mysql storage provider (parameter=%v)...", parameter)
	mysqlConnPool = &pool.Pool{Id: "MySQL Connection Pool", Size: int(parameter.PoolSize)}
	initFunc := func() (interface{}, error) {
		conn := autorc.New("tcp", "", mysqlServerAddr, parameter.User, parameter.Password)
		conn.Raw.Register("set names utf8")
		err := conn.Use(parameter.DbName)
		if err != nil {
			errorMsg := fmt.Sprintf("Occur error when mysql connection initialization (parameter=%v): %s\n", parameter, err)
			Logger().Errorln(errorMsg)
			return nil, err
		}
		return conn, nil
	}
	err := mysqlConnPool.Init(initFunc)
	if err != nil {
		errorMsg := fmt.Sprintf("Occur error when mysql connection pool initialization (parameter=%v): %s\n", parameter, err)
		Logger().Errorln(errorMsg)
		return errors.New(errorMsg)
	}
	signMap = make(map[string]*go_lib.Sign)
	iMysqlStorageProvider = &mysqlStorageProvider{parameter.Name}
	return nil
}
开发者ID:hyper-carrot,项目名称:go_idcenter,代码行数:25,代码来源:mysql_storage_provider.go

示例2: dumpChunk

// dumps a specific chunk, reading chunk info from the cchunk channel
func dumpChunk(cc string) {
	var out *os.File
	dbcon := autorc.New("tcp", "", host+":"+port, user, password, schema)
	defer func() {
		out.Close()
		if err := recover(); err != nil {
			die(err.(error).Error())
		}
		wg.Done()
	}()

	for {
		cr := <-cchunks
		out, _ = os.Create(path + "/" + schema + "." + table + "." + strconv.Itoa(cr.lower) + "." + strconv.Itoa(cr.upper) + ".csv")
		rows, _, _ := dbcon.Query("select * from " + schema + "." + table + " where " + cc + " between " + strconv.Itoa(cr.lower) + " and " + strconv.Itoa(cr.upper))
		for _, row := range rows {
			line := ""

			for idx, _ := range row {
				comma := ","
				if idx == len(row)-1 {
					comma = ""
				}
				line += row.Str(idx) + comma
			}

			out.WriteString(line + "\n")
		}
		if done {
			return
		}
	}
}
开发者ID:fipar,项目名称:mychunker,代码行数:34,代码来源:mychunker.go

示例3: initMySQL

// connects to MySQL
func initMySQL() {
	var err error
	debug("connecting to MySQL")
	debug("Will connect to tcp, " + host + ":" + port + ", " + user + ", " + password + ", " + schema)
	db = autorc.New("tcp", "", host+":"+port, user, password, schema)
	_, _, err = db.Query("select 1")
	if err != nil {
		die("An error occurred while connecting to MySQL: " + err.Error())
	}
}
开发者ID:fipar,项目名称:mychunker,代码行数:11,代码来源:mychunker.go

示例4: initConn

//func initConn() (*autorc.Conn, error) {
func initConn() (interface{}, error) {
	conn := autorc.New("tcp", "", "localhost:3306", "root", "root", "test")
	// Register initialisation commands
	conn.Register("set names utf8")
	fmt.Println(" --- autorc --- ", conn.Raw, " --- ")
	//rows, res, err := db.Query("Select * From `test` Limit 1")
	//fmt.Println(rows)
	//fmt.Println(res)
	//fmt.Println(err)
	return conn, nil
}
开发者ID:highestgoodlikewater,项目名称:epooll,代码行数:12,代码来源:db_test.go

示例5: main

func main() {
	// START OMIT
	conn := autorc.New("tcp", "", "localhost:3306", "user", "passwd", "database")
	stmtSelectFooBar, err := conn.Prepare(`SELECT foo, bar FROM stuff WHERE ID = ?`)
	if err != nil {
		panic(err)
	}
	rows, res, err := stmtSelectFooBar.Exec(42)
	if err != nil {
		panic(err)
	}
	for _, row := range rows {
		foo := row.Str(res.Map("foo"))
		bar := row.Uint64(res.Map("bar"))
		fmt.Println(foo, bar)
	}
	// END OMIT
}
开发者ID:GeertJohan,项目名称:gotalks,代码行数:18,代码来源:mymysql.go

示例6: InitDB

// (读+写)连接数据库+选择数据库
//func InitDB(address, user, pass, name string, logSlowQuery bool, logSlowTime int64) (*DB, error){
func InitDB() (*DB, error) {
	//fmt.Println("InitDB")
	host := conf.GetValue("db", "host")
	port := conf.GetValue("db", "port")
	user := conf.GetValue("db", "user")
	pass := conf.GetValue("db", "pass")
	name := conf.GetValue("db", "name")
	logSlowQuery, _ := strconv.ParseBool(conf.GetValue("db", "log_slow_query"))
	logSlowTime, _ := strconv.ParseInt(conf.GetValue("db", "log_slow_time"), 0, 64)
	address := host + ":" + port

	//db := new(DB)
	db := &DB{logSlowQuery: logSlowQuery, logSlowTime: logSlowTime}
	conn := autorc.New("tcp", "", address, user, pass, name)
	conn.Register("set names utf8")
	db.Conn = conn
	return db, nil
}
开发者ID:highestgoodlikewater,项目名称:epooll,代码行数:20,代码来源:db.go

示例7: Open

// username:[email protected](address:port)/dbname
func (self *dbExecutor) Open(dsn string, showOperate bool, connCount int) error {
	self.showOperate = showOperate

	self.connChan = make(chan *autorc.Conn, connCount)

	var conn *autorc.Conn

	for i := 0; i < connCount; i++ {

		if usr, passwd, nettype, addr, dbname, err := parseDSN(dsn); err == nil {

			//func New(proto, laddr, raddr, user, passwd string, db ...string) *Conn {
			conn = autorc.New(nettype, "", addr, usr, passwd, dbname)
		} else {
			return err
		}

		self.connChan <- conn
	}

	return nil
}
开发者ID:chogaths,项目名称:robin,代码行数:23,代码来源:dbexec.go

示例8: testDbConnections

// test database connection settings
func (g *GuerrillaDBAndRedisBackend) testDbConnections() (err error) {
	db := autorc.New(
		"tcp",
		"",
		g.config.MysqlHost,
		g.config.MysqlUser,
		g.config.MysqlPass,
		g.config.MysqlDB)

	if mysqlErr := db.Raw.Connect(); mysqlErr != nil {
		err = fmt.Errorf("MySql cannot connect, check your settings: %s", mysqlErr)
	} else {
		db.Raw.Close()
	}

	redisClient := &redisClient{}
	if redisErr := redisClient.redisConnection(g.config.RedisInterface); redisErr != nil {
		err = fmt.Errorf("Redis cannot connect, check your settings: %s", redisErr)
	}

	return
}
开发者ID:flashmob,项目名称:go-guerrilla,代码行数:23,代码来源:guerrilla_db_redis.go

示例9: New

func New(host string, port string, user string, password string, database string, tdhPort string) *Handa {
	self := &Handa{
		tableCacheVarMutex: new(sync.Mutex),
	}

	// DDL listeners
	self.startTableDDLListener()
	self.columnDDL = make(map[string]chan columnDDLReq)
	self.indexDDL = make(map[string]chan indexDDLReq)

	// init database connection pool
	self.dbname = database
	self.mysqlConnPool = make(chan *autorc.Conn, MysqlConnPoolSize)
	for i := 0; i < MysqlConnPoolSize; i++ {
		conn := autorc.New("tcp", "", host+":"+port, user, password, database)
		conn.Register("set names utf8")
		self.mysqlConnPool <- conn
	}
	self.socketConnPool = make(chan *tdh.Conn, SocketConnPoolSize)
	for i := 0; i < SocketConnPoolSize; i++ {
		socket, err := tdh.New(host+":"+tdhPort, "", "")
		if err != nil {
			fatal("Tdhsocket connect error")
		}
		self.socketConnPool <- socket
	}

	// load table schemas
	schema := make(map[string]*TableInfo)
	row, _, _ := self.mysqlQuery("SHOW TABLES")
	for _, row := range row {
		tableName := row.Str(0)
		schema[tableName] = self.loadTableInfo(tableName)
	}
	self.schema = schema

	return self
}
开发者ID:reusee,项目名称:handa,代码行数:38,代码来源:handa.go

示例10: InitDatabase

func InitDatabase(addr, name, password, dbname string) {
	db = mysql.New("tcp", "", addr, name, password, dbname)
}
开发者ID:navy1125,项目名称:gameauth,代码行数:3,代码来源:mysql.go

示例11: init

func init() {
	var err error

	loadConf()

	if len(config.Db.Addr) < 1 ||
		len(config.Db.User) < 1 ||
		len(config.Db.Pass) < 1 ||
		len(config.Db.Name) < 1 {
		fmt.Printf("Missing db config\n")
		os.Exit(1)
	}

	db = autorc.New("tcp", "",
		config.Db.Addr,
		config.Db.User,
		config.Db.Pass,
		config.Db.Name)

	db.Raw.Register("SET NAMES utf8")

	plugin_insert_stmt, err = db.Prepare("INSERT INTO plugin (id, owner) VALUES(?, ?)")
	mysqlErrExit(err)

	version_insert_stmt, err = db.Prepare("INSERT INTO version (plugin_id, version, type, author, showtime_min_version, title, synopsis, description, homepage, pkg_digest, category, icon_digest, status) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
	mysqlErrExit(err)

	version_delete_stmt, err = db.Prepare("DELETE FROM version WHERE plugin_id=? AND version=?")
	mysqlErrExit(err)

	status_set_stmt, err = db.Prepare("UPDATE version SET status=? WHERE plugin_id=? AND version=?")
	mysqlErrExit(err)

	published_set_stmt, err = db.Prepare("UPDATE version SET published=? WHERE plugin_id=? AND version=?")
	mysqlErrExit(err)

	user_query_stmt, err = db.Prepare("SELECT salt, sha1, email, admin, autoapprove FROM users WHERE username = ?")
	mysqlErrExit(err)

	admin_query_stmt, err = db.Prepare("SELECT username, email, autoapprove FROM users WHERE admin = true")
	mysqlErrExit(err)

	user_insert_stmt, err = db.Prepare("INSERT INTO users (username, salt, sha1, email) VALUES(?, ?, ?, ?)")
	mysqlErrExit(err)

	version_dlinc_stmt, err = db.Prepare("UPDATE version SET downloads=downloads+1 WHERE plugin_id = ? AND version = ?")
	mysqlErrExit(err)

	plugin_update_stmt, err = db.Prepare("UPDATE plugin SET betasecret=?, downloadurl=? WHERE id=?")
	mysqlErrExit(err)

	track_update_stmt, err = db.Prepare("INSERT INTO tracking (id, ua, count, ipaddr, cc) VALUE (?, ?, 1, ?, ?) ON DUPLICATE KEY UPDATE count=count + 1, ua=?, updated=now(), ipaddr=?, cc=?")
	mysqlErrExit(err)

	plugin_delete_stmt, err = db.Prepare("DELETE FROM plugin WHERE id=?")
	mysqlErrExit(err)

	rows, _, err := db.Query("SELECT id, owner, betasecret,downloadurl FROM plugin")
	mysqlErrExit(err)

	for _, r := range rows {
		id := r.Str(0)
		plugins[id] = newPlugin(id, r.Str(1), r.Str(2), r.Str(3))
	}

	rows, _, err = db.Query("SELECT plugin_id, version, type, author, downloads," +
		"published, showtime_min_version, title, synopsis, description," +
		"homepage, pkg_digest, comment, category, status, icon_digest FROM version")
	mysqlErrExit(err)

	for _, r := range rows {
		plugin_id := r.Str(0)
		version := r.Str(1)
		v := PluginVersion{
			PluginId:        plugin_id,
			Version:         version,
			Type:            r.Str(2),
			Author:          r.Str(3),
			Downloads:       r.Int(4),
			Published:       r.Bool(5),
			ShowtimeVersion: r.Str(6),
			Title:           r.Str(7),
			Synopsis:        r.Str(8),
			Description:     r.Str(9),
			Homepage:        r.Str(10),
			PkgDigest:       r.Str(11),
			Comment:         r.Str(12),
			Category:        r.Str(13),
			Status:          r.Str(14),
			IconDigest:      r.Str(15),
		}
		plugins[plugin_id].versions[version] = &v
		pkgHashToVersion[v.PkgDigest] = &v

		v.pkg_ver, err = parseVersionString(v.Version)
		if err != nil {
			log.Println(err)
			os.Exit(1)
		}

//.........这里部分代码省略.........
开发者ID:andoma,项目名称:spmc,代码行数:101,代码来源:db.go

示例12: saveMail

func (g *GuerrillaDBAndRedisBackend) saveMail() {
	var to, body string
	var err error

	var redisErr error
	var length int
	redisClient := &redisClient{}
	db := autorc.New(
		"tcp",
		"",
		g.config.MysqlHost,
		g.config.MysqlUser,
		g.config.MysqlPass,
		g.config.MysqlDB)
	db.Register("set names utf8")
	sql := "INSERT INTO " + g.config.MysqlTable + " "
	sql += "(`date`, `to`, `from`, `subject`, `body`, `charset`, `mail`, `spam_score`, `hash`, `content_type`, `recipient`, `has_attach`, `ip_addr`, `return_path`, `is_tls`)"
	sql += " values (NOW(), ?, ?, ?, ? , 'UTF-8' , ?, 0, ?, '', ?, 0, ?, ?, ?)"
	ins, sqlErr := db.Prepare(sql)
	if sqlErr != nil {
		log.WithError(sqlErr).Fatalf("failed while db.Prepare(INSERT...)")
	}
	sql = "UPDATE gm2_setting SET `setting_value` = `setting_value`+1 WHERE `setting_name`='received_emails' LIMIT 1"
	incr, sqlErr := db.Prepare(sql)
	if sqlErr != nil {
		log.WithError(sqlErr).Fatalf("failed while db.Prepare(UPDATE...)")
	}

	//  receives values from the channel repeatedly until it is closed.
	for {
		payload := <-g.saveMailChan
		if payload == nil {
			log.Debug("No more payload")
			g.wg.Done()
			return
		}
		to = payload.recipient.User + "@" + g.config.PrimaryHost
		length = len(payload.mail.Data)
		ts := fmt.Sprintf("%d", time.Now().UnixNano())
		payload.mail.Subject = MimeHeaderDecode(payload.mail.Subject)
		hash := MD5Hex(
			to,
			payload.mail.MailFrom.String(),
			payload.mail.Subject,
			ts)
		// Add extra headers
		var addHead string
		addHead += "Delivered-To: " + to + "\r\n"
		addHead += "Received: from " + payload.mail.Helo + " (" + payload.mail.Helo + "  [" + payload.mail.RemoteAddress + "])\r\n"
		addHead += "	by " + payload.recipient.Host + " with SMTP id " + hash + "@" + payload.recipient.Host + ";\r\n"
		addHead += "	" + time.Now().Format(time.RFC1123Z) + "\r\n"
		// compress to save space
		payload.mail.Data = Compress(addHead, payload.mail.Data)
		body = "gzencode"
		redisErr = redisClient.redisConnection(g.config.RedisInterface)
		if redisErr == nil {
			_, doErr := redisClient.conn.Do("SETEX", hash, g.config.RedisExpireSeconds, payload.mail.Data)
			if doErr == nil {
				payload.mail.Data = ""
				body = "redis"
			}
		} else {
			log.WithError(redisErr).Warn("Error while SETEX on redis")
		}
		// bind data to cursor
		ins.Bind(
			to,
			payload.mail.MailFrom.String(),
			payload.mail.Subject,
			body,
			payload.mail.Data,
			hash,
			to,
			payload.mail.RemoteAddress,
			payload.mail.MailFrom.String(),
			payload.mail.TLS,
		)
		// save, discard result
		_, _, err = ins.Exec()
		if err != nil {
			errMsg := "Database error while inserting"
			log.WithError(err).Warn(errMsg)
			payload.savedNotify <- &saveStatus{errors.New(errMsg), hash}
		} else {
			log.Debugf("Email saved %s (len=%d)", hash, length)
			_, _, err = incr.Exec()
			if err != nil {
				log.WithError(err).Warn("Database error while incr count")
			}
			payload.savedNotify <- &saveStatus{nil, hash}
		}
	}
}
开发者ID:flashmob,项目名称:go-guerrilla,代码行数:93,代码来源:guerrilla_db_redis.go

示例13: apn_error_processor_status_inactive

// TODO: Try for at least 3 times before discarding a message (+ What happens if new field is added to MQ json ?)
// DONE: Implement kill channel for the goroutine
func apn_error_processor_status_inactive(config Configuration, conn *amqp.Connection, ApnStatusInactiveQueueName string,
	ch_custom_err chan []byte, logger *log.Logger, killApnStatusInactive, killApnStatusInactiveAck chan int, gq ApnQueue) {
	// Connect to a database
	db := autorc.New("tcp", "", config.Db.DbHost+":"+strconv.Itoa(config.Db.DbPort), config.Db.DbUser, config.Db.DbPassword, config.Db.DbDatabase)

	var upd autorc.Stmt
	err := db.PrepareOnce(&upd, gq.Queries.StatusInactive)
	if err != nil {
		failOnError(err, "Could not create prepared statement")
	}

	// Create new channel for Status Inactive
	ch, err := conn.Channel()
	failOnError(err, "Failed to open a channel")
	defer ch.Close()

	err = ch.Qos(
		1,     // prefetch count
		0,     // prefetch size
		false, // global
	)
	failOnError(err, "Failed to set QoS")

	// Connect to ApnStatusInactiveQueueName channel as consumer
	msgsStatusInactive, err := ch.Consume(
		ApnStatusInactiveQueueName, // queue
		"",    // consumer
		false, // auto-ack
		false, // exclusive
		false, // no-local
		false, // no-wait
		nil,   // args
	)
	failOnError(err, "Failed to register a consumer")

	i := 0
	payloads := make([]ApnStatusInactiveMsg, config.Db.TransactionMinCount.StatusInactive)
	for {
		select {
		case d, ok := <-msgsStatusInactive:
			if !ok {
				time.Sleep(100 * time.Millisecond)
				continue
			}
			olog(fmt.Sprintf("APN Status Inactive Received a message: %s", d.Body), config.DebugMode)

			payload := ApnStatusInactiveMsg{}
			err := json.Unmarshal(d.Body, &payload)

			if err != nil {
				logger.Printf("Unmarshal error for APN status Inactive MQ message data = %s", d.Body)
				olog(fmt.Sprintf("Unmarshal error for APN Token Update MQ message data = %s", d.Body), config.DebugMode)
			} else {
				payloads[i] = payload
				i++

				if i == config.Db.TransactionMinCount.StatusInactive {
					i = 0
					err := db.Begin(func(tr mysql.Transaction, args ...interface{}) error {
						for _, v := range payloads {
							if v.Token != "" {
								_, err := tr.Do(upd.Raw).Run(v.Token)
								if err != nil {
									return err
								}
							}
						}
						return tr.Commit()
					})
					t := time.Now()
					ts := t.Format(time.RFC3339)

					if err != nil {
						// ERROR WHILE UPDATING DB

						olog("Database Transaction Error StatusErrStatusInactiveTransaction", config.DebugMode)

						errInfo := make(map[string]interface{})
						errInfo["error"] = err.Error()
						errInfo["payloads"] = payloads
						errLog := DbLog{TimeStamp: ts, Type: StatusErrStatusInactiveTransaction, Data: errInfo}

						errLogByte, err := json.Marshal(errLog)
						if err == nil {
							ch_custom_err <- errLogByte
						} else {
							logger.Printf("Marshal error for ErrStatusInactiveTransaction")
						}
					} else {
						// SUCCESSFULLY UPDATED
						olog("Database Transaction Success StatusSuccessStatusInactiveTransaction", config.DebugMode)
						errLog := DbLog{TimeStamp: ts, Type: StatusSuccessStatusInactiveTransaction, Data: payloads}

						errLogByte, err := json.Marshal(errLog)
						if err == nil {
							ch_custom_err <- errLogByte
						} else {
							logger.Printf("Marshal error for StatusErrStatusInactiveTransaction")
//.........这里部分代码省略.........
开发者ID:touchtalent,项目名称:blitz,代码行数:101,代码来源:apnStatusInactive.go

示例14: MysqlError

package database

import (
	"github.com/ziutek/mymysql/autorc"
	"log"
	"os"
)

var (
	// MySQL Connection Handler
	CurtDevDb = autorc.New(db_proto, "", db_addr, db_user, db_pass, CurtDevdb_name)
	AdminDb   = autorc.New(db_proto, "", db_addr, db_user, db_pass, Admindb_name)
)

func MysqlError(err error) (ret bool) {
	ret = (err != nil)
	if ret {
		log.Println("MySQL error: ", err)
	}
	return
}

func MysqlErrExit(err error) {
	if MysqlError(err) {
		os.Exit(1)
	}
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:27,代码来源:database_hlp.go

示例15: saveMail

func saveMail() {
	var to string
	var err error
	var body string
	var redis_err error
	var length int
	redis := &redisClient{}
	db := autorc.New("tcp", "", gConfig["MYSQL_HOST"], gConfig["MYSQL_USER"], gConfig["MYSQL_PASS"], gConfig["MYSQL_DB"])
	db.Register("set names utf8")
	sql := "INSERT INTO " + gConfig["GM_MAIL_TABLE"] + " "
	sql += "(`date`, `to`, `from`, `subject`, `body`, `charset`, `mail`, `spam_score`, `hash`, `content_type`, `recipient`, `has_attach`, `ip_addr`)"
	sql += " values (NOW(), ?, ?, ?, ? , 'UTF-8' , ?, 0, ?, '', ?, 0, ?)"
	ins, sql_err := db.Prepare(sql)
	if sql_err != nil {
		logln(2, fmt.Sprintf("Sql statement incorrect: %s", sql_err))
	}
	sql = "UPDATE gm2_setting SET `setting_value` = `setting_value`+1 WHERE `setting_name`='received_emails' LIMIT 1"
	incr, sql_err := db.Prepare(sql)
	if sql_err != nil {
		logln(2, fmt.Sprintf("Sql statement incorrect: %s", sql_err))
	}

	//  receives values from the channel repeatedly until it is closed.
	for {
		client := <-SaveMailChan
		if user, _, addr_err := validateEmailData(client); addr_err != nil { // user, host, addr_err
			logln(1, fmt.Sprintln("mail_from didnt validate: %v", addr_err)+" client.mail_from:"+client.mail_from)
			// notify client that a save completed, -1 = error
			client.savedNotify <- -1
			continue
		} else {
			to = user + "@" + gConfig["GM_PRIMARY_MAIL_HOST"]
		}
		length = len(client.data)
		client.subject = mimeHeaderDecode(client.subject)
		client.hash = md5hex(to + client.mail_from + client.subject + strconv.FormatInt(time.Now().UnixNano(), 10))
		// Add extra headers
		add_head := ""
		add_head += "Delivered-To: " + to + "\r\n"
		add_head += "Received: from " + client.helo + " (" + client.helo + "  [" + client.address + "])\r\n"
		add_head += "	by " + gConfig["GSMTP_HOST_NAME"] + " with SMTP id " + client.hash + "@" +
			gConfig["GSMTP_HOST_NAME"] + ";\r\n"
		add_head += "	" + time.Now().Format(time.RFC1123Z) + "\r\n"
		// compress to save space
		client.data = compress(add_head + client.data)
		body = "gzencode"
		redis_err = redis.redisConnection()
		if redis_err == nil {
			_, do_err := redis.conn.Do("SETEX", client.hash, 3600, client.data)
			if do_err == nil {
				client.data = ""
				body = "redis"
			}
		} else {
			logln(1, fmt.Sprintf("redis: %v", redis_err))
		}
		// bind data to cursor
		ins.Bind(
			to,
			client.mail_from,
			client.subject,
			body,
			client.data,
			client.hash,
			to,
			client.address)
		// save, discard result
		_, _, err = ins.Exec()
		if err != nil {
			logln(1, fmt.Sprintf("Database error, %v %v", err))
			client.savedNotify <- -1
		} else {
			logln(1, "Email saved "+client.hash+" len:"+strconv.Itoa(length))
			_, _, err = incr.Exec()
			if err != nil {
				logln(1, fmt.Sprintf("Failed to incr count:", err))
			}
			client.savedNotify <- 1
		}
	}
}
开发者ID:anthonybishopric,项目名称:go-guerrilla,代码行数:81,代码来源:goguerrilla.go


注:本文中的github.com/ziutek/mymysql/autorc.New函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。