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


Golang MConn.QueryRow方法代码示例

本文整理汇总了Golang中ftnox/com/db.MConn.QueryRow方法的典型用法代码示例。如果您正苦于以下问题:Golang MConn.QueryRow方法的具体用法?Golang MConn.QueryRow怎么用?Golang MConn.QueryRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ftnox/com/db.MConn的用法示例。


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

示例1: SavePayment

func SavePayment(c db.MConn, p *Payment) (*Payment, error) {
	if p.Time == 0 {
		p.Time = time.Now().Unix()
	}
	err := c.QueryRow(
		`INSERT INTO payment (`+PaymentModel.FieldsInsert+`)
         VALUES (`+PaymentModel.Placeholders+`)
         RETURNING id`,
		p,
	).Scan(&p.Id)
	return p, err
}
开发者ID:jaekwon,项目名称:ftnox-backend,代码行数:12,代码来源:models.go

示例2: LoadWithdrawal

func LoadWithdrawal(c db.MConn, id int64) *Withdrawal {
	var wth Withdrawal
	err := c.QueryRow(
		`SELECT `+WithdrawalModel.FieldsSimple+`
         FROM account_withdrawal
         WHERE id=?`,
		id,
	).Scan(&wth)
	if err != nil {
		panic(err)
	}
	return &wth
}
开发者ID:jaekwon,项目名称:ftnox-backend,代码行数:13,代码来源:models.go

示例3: LoadDepositForPayment

func LoadDepositForPayment(c db.MConn, paymentId int64) *Deposit {
	var dep Deposit
	err := c.QueryRow(
		`SELECT `+DepositModel.FieldsSimple+`
         FROM account_deposit
         WHERE payment_id=?`,
		paymentId,
	).Scan(&dep)
	if err != nil {
		panic(err)
	}
	return &dep
}
开发者ID:jaekwon,项目名称:ftnox-backend,代码行数:13,代码来源:models.go

示例4: SaveDeposit

// Might throw an error if the deposit already exists.
func SaveDeposit(c db.MConn, dep *Deposit) (*Deposit, error) {
	if dep.Time == 0 {
		dep.Time = time.Now().Unix()
	}
	// Add to DB
	err := c.QueryRow(
		`INSERT INTO account_deposit (`+DepositModel.FieldsInsert+`)
         VALUES (`+DepositModel.Placeholders+`)
         RETURNING id`,
		dep,
	).Scan(&dep.Id)
	return dep, err
}
开发者ID:jaekwon,项目名称:ftnox-backend,代码行数:14,代码来源:models.go

示例5: SaveTransfer

func SaveTransfer(c db.MConn, trans *Transfer) *Transfer {
	if trans.Time == 0 {
		trans.Time = time.Now().Unix()
	}
	err := c.QueryRow(
		`INSERT INTO account_transfer (`+TransferModel.FieldsInsert+`)
         VALUES (`+TransferModel.Placeholders+`)
         RETURNING id`,
		trans,
	).Scan(&trans.Id)
	if err != nil {
		panic(err)
	}
	return trans
}
开发者ID:jaekwon,项目名称:ftnox-backend,代码行数:15,代码来源:models.go

示例6: SaveWithdrawal

func SaveWithdrawal(c db.MConn, wth *Withdrawal) *Withdrawal {
	if wth.Time == 0 {
		wth.Time = time.Now().Unix()
	}
	// Add to DB
	err := c.QueryRow(
		`INSERT INTO account_withdrawal (`+WithdrawalModel.FieldsInsert+`)
         VALUES (`+WithdrawalModel.Placeholders+`)
         RETURNING id`,
		wth,
	).Scan(&wth.Id)
	if err != nil {
		panic(err)
	}
	return wth
}
开发者ID:jaekwon,项目名称:ftnox-backend,代码行数:16,代码来源:models.go


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