// AddressHasPendingWithdrawal returns whether an address has a pending withdrawal
AddressHasPendingWithdrawal returns whether an address has a pending withdrawal
// AddressHasPendingWithdrawal returns whether an address has a pending withdrawal
func AddressHasPendingWithdrawal(node sqalx.Node, address string) (bool, int, int, error) {
	tx, err := node.Beginx()
	if err != nil {
		return false, 0, 0, stacktrace.Propagate(err, "")
	}
	defer tx.Commit() 
	var position int
	var total int
	err = sdb.Select("position", "total").
		FromSelect(
			sdb.Select(
				"rewards_address",
				"ROW_NUMBER() OVER (ORDER BY pending_withdrawal.started_at DESC, pending_withdrawal.rewards_address) AS position",
				"SUM(COUNT(*)) OVER () AS total").
				From("pending_withdrawal").
				GroupBy("rewards_address"), "queue_position").
		Where(sq.Eq{"rewards_address": address}).
		RunWith(tx).Scan(&position, &total)
	if err != nil && errors.Is(err, sql.ErrNoRows) {
		return false, 0, 0, nil
	} else if err != nil {
		return false, 0, 0, stacktrace.Propagate(err, "")
	}
	return true, position, total, nil
}
func AddressHasPendingWithdrawal ( node sqalx . Node , address string ) ( bool , int , int , error ) { tx , err := node . Beginx ( ) if err != nil { return false , 0 , 0 , stacktrace . Propagate ( err , " " ) } defer tx . Commit ( ) var position int var total int err = sdb . Select ( " " , " " ) . FromSelect ( sdb . Select ( " " , " " , " " ) . From ( " " ) . GroupBy ( " " ) , " " ) . Where ( sq . Eq { " " : address } ) . RunWith ( tx ) . Scan ( & position , & total ) if err != nil && errors . Is ( err , sql . ErrNoRows ) { return false , 0 , 0 , nil } else if err != nil { return false , 0 , 0 , stacktrace . Propagate ( err , " " ) } return true , position , total , nil }
AddressHasPendingWithdrawal returns whether an address has a pending withdrawal
AddressHasPendingWithdrawal returns whether an address has a pending withdrawal
// read-only tx