MCPcopy
hub / github.com/daptin/daptin / GetUserEmailByIdWithTransaction

Method GetUserEmailByIdWithTransaction

server/resource/dbmethods.go:2041–2061  ·  view source on GitHub ↗
(userId int64, transaction *sqlx.Tx)

Source from the content-addressed store, hash-verified

2039}
2040
2041func (dbResource *DbResource) GetUserEmailByIdWithTransaction(userId int64, transaction *sqlx.Tx) string {
2042 s, q, err := statementbuilder.Squirrel.Select("email").Prepared(true).
2043 From(USER_ACCOUNT_TABLE_NAME).Where(goqu.Ex{"id": userId}).ToSQL()
2044 if err != nil {
2045 log.Errorf("failed to create email lookup query: %v", err)
2046 return ""
2047 }
2048 stmt1, err := transaction.Preparex(s)
2049 if err != nil {
2050 log.Errorf("failed to prepare email lookup statement: %v", err)
2051 return ""
2052 }
2053 defer stmt1.Close()
2054 var email string
2055 err = stmt1.QueryRowx(q...).Scan(&email)
2056 if err != nil {
2057 log.Warnf("failed to get email for user_account_id %d: %v", userId, err)
2058 return ""
2059 }
2060 return email
2061}
2062
2063func (dbResource *DbResource) GetSingleRowByReferenceIdWithTransaction(typeName string, referenceId daptinid.DaptinReferenceId,
2064 includedRelations map[string]bool, transaction *sqlx.Tx) (map[string]interface{}, []map[string]interface{}, error) {

Calls 5

ScanMethod · 0.80
QueryRowxMethod · 0.80
SelectMethod · 0.65
PreparexMethod · 0.65
CloseMethod · 0.65