本文整理汇总了Golang中github.com/jmoiron/sqlx.Tx.Execv方法的典型用法代码示例。如果您正苦于以下问题:Golang Tx.Execv方法的具体用法?Golang Tx.Execv怎么用?Golang Tx.Execv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jmoiron/sqlx.Tx
的用法示例。
在下文中一共展示了Tx.Execv方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: updatePrimaryUat
func (w *Worker) updatePrimaryUat(tx *sqlx.Tx, pubkey *Pubkey, r *UserAttribute) error {
if pubkey.PrimaryUat.String == r.ScopedDigest {
if _, err := tx.Execv(`
UPDATE openpgp_pubkey SET primary_uat = $1 WHERE uuid = $2`,
r.ScopedDigest, pubkey.RFingerprint); err != nil {
return err
}
}
return nil
}
示例2: updateUatRevsig
func (w *Worker) updateUatRevsig(tx *sqlx.Tx, uat *UserAttribute, r *Signature) error {
if uat.RevSigDigest.String == r.ScopedDigest {
if _, err := tx.Execv(`
UPDATE openpgp_uat SET revsig_uuid = $1 WHERE uuid = $2`,
r.ScopedDigest, uat.ScopedDigest); err != nil {
return err
}
}
return nil
}
示例3: updateSubkeyRevsig
func (w *Worker) updateSubkeyRevsig(tx *sqlx.Tx, subkey *Subkey, r *Signature) error {
if subkey.RevSigDigest.String == r.ScopedDigest {
if _, err := tx.Execv(`
UPDATE openpgp_subkey SET revsig_uuid = $1 WHERE uuid = $2`,
r.ScopedDigest, subkey.RFingerprint); err != nil {
return err
}
}
return nil
}
示例4: insertUat
func (l *Loader) insertUat(tx *sqlx.Tx, pubkey *Pubkey, r *UserAttribute) error {
_, err := tx.Execv(l.insertSelectFrom(`
INSERT INTO openpgp_uat (
uuid, creation, expiration, state, packet,
pubkey_uuid, revsig_uuid)
SELECT $1, $2, $3, $4, $5,
$6, $7`,
"openpgp_uat", "uuid = $1"),
r.ScopedDigest, r.Creation, r.Expiration, r.State, r.Packet,
pubkey.RFingerprint, r.RevSigDigest)
return err
}
示例5: insertUid
func (l *Loader) insertUid(tx *sqlx.Tx, pubkey *Pubkey, r *UserId) error {
_, err := tx.Execv(l.insertSelectFrom(`
INSERT INTO openpgp_uid (
uuid, creation, expiration, state, packet,
pubkey_uuid, revsig_uuid, keywords, keywords_fulltext)
SELECT $1, $2, $3, $4, $5,
$6, $7, $8, to_tsvector($8)`,
"openpgp_uid", "uuid = $1"),
r.ScopedDigest, r.Creation, r.Expiration, r.State, r.Packet,
pubkey.RFingerprint, r.RevSigDigest, util.CleanUtf8(r.Keywords))
return err
}
示例6: insertSubkey
func (l *Loader) insertSubkey(tx *sqlx.Tx, pubkey *Pubkey, r *Subkey) error {
_, err := tx.Execv(l.insertSelectFrom(`
INSERT INTO openpgp_subkey (
uuid, creation, expiration, state, packet,
pubkey_uuid, revsig_uuid, algorithm, bit_len)
SELECT $1, $2, $3, $4, $5,
$6, $7, $8, $9`,
"openpgp_subkey", "uuid = $1"),
r.RFingerprint, r.Creation, r.Expiration, r.State, r.Packet,
pubkey.RFingerprint, r.RevSigDigest, r.Algorithm, r.BitLen)
return err
}
示例7: insertSig
func (l *Loader) insertSig(tx *sqlx.Tx, pubkey *Pubkey, signable PacketRecord, r *Signature) error {
baseSql := `
INSERT INTO openpgp_sig (
uuid, creation, expiration, state, packet,
sig_type, signer, signer_uuid%s)
SELECT $1, $2, $3, $4, $5, $6, $7, $8%s`
matchSql := "uuid = $1"
args := []interface{}{
r.ScopedDigest, r.Creation, r.Expiration, r.State, r.Packet,
r.SigType, r.RIssuerKeyId, r.RIssuerFingerprint,
}
var sql string
switch signed := signable.(type) {
case *Pubkey:
sql = fmt.Sprintf(baseSql,
", pubkey_uuid",
", $9")
args = append(args, signed.RFingerprint)
matchSql += " AND pubkey_uuid = $9"
case *Subkey:
sql = fmt.Sprintf(baseSql,
", pubkey_uuid, subkey_uuid",
", $9, $10")
args = append(args, pubkey.RFingerprint, signed.RFingerprint)
matchSql += " AND pubkey_uuid = $9 AND subkey_uuid = $10"
case *UserId:
sql = fmt.Sprintf(baseSql,
", pubkey_uuid, uid_uuid",
", $9, $10")
args = append(args, pubkey.RFingerprint, signed.ScopedDigest)
matchSql += " AND pubkey_uuid = $9 AND uid_uuid = $10"
case *UserAttribute:
sql = fmt.Sprintf(baseSql,
", pubkey_uuid, uat_uuid",
", $9, $10")
args = append(args, pubkey.RFingerprint, signed.ScopedDigest)
matchSql += " AND pubkey_uuid = $9 AND uat_uuid = $10"
case *Signature:
sql = fmt.Sprintf(baseSql,
", pubkey_uuid, sig_uuid",
", $9, $10")
args = append(args, pubkey.RFingerprint, signed.ScopedDigest)
matchSql += " AND pubkey_uuid = $9 AND sig_uuid = $10"
default:
return fmt.Errorf("Unsupported packet record type: %v", signed)
}
_, err := tx.Execv(l.insertSelectFrom(sql, "openpgp_sig", matchSql), args...)
// TODO: use RETURNING to update matched issuer fingerprint
return err
}
示例8: insertPubkey
func (l *Loader) insertPubkey(tx *sqlx.Tx, r *Pubkey) error {
_, err := tx.Execv(l.insertSelectFrom(`
INSERT INTO openpgp_pubkey (
uuid, creation, expiration, state, packet,
ctime, mtime,
md5, sha256, revsig_uuid, primary_uid, primary_uat,
algorithm, bit_len, unsupp)
SELECT $1, $2, $3, $4, $5,
now(), now(),
$6, $7, $8, $9, $10,
$11, $12, $13`,
"openpgp_pubkey", "uuid = $1"),
r.RFingerprint, r.Creation, r.Expiration, r.State, r.Packet,
// TODO: use mtime and ctime from record, or use RETURNING to set it
r.Md5, r.Sha256, r.RevSigDigest, r.PrimaryUid, r.PrimaryUat,
r.Algorithm, r.BitLen, r.Unsupported)
return err
}