Analytics review fixes: - Store Twitter analytics coverage as discrete intervals instead of a single contiguous window so disjoint fetch ranges no longer mask inner gaps as covered (fetch per uncovered range, add gap regression tests) - Compute real AvgEngagement/Correlation in getEngagementDrivers instead of all-zero placeholders - Make parseAnalyticsTimeRange surface invalid timestamps, cap merged analytics posts at limit, and normalize sentiment by timestamped posts only - gofmt: fix misalignment in config.go and types.go - Include Twitter in the default aggregate analytics scope; its API costs are passed to the caller through paid tool pricing x402 cost passing: - computeTwitterStyleProfileCost now charges base cost ($0.10) + user lookup ($0.01) + $0.005 per Twitter post, guaranteeing the charge always clears the underlying API cost (never break-even or loss) - Return a $-prefixed dollar string for the settlement override, fixing the previously off-by-factor-100 raw-atomic-unit amount - Raise getStyleProfile base registration to $0.36 to authorize the max Twitter charge - Add tests for the cost formula, profitable floor, and dollar formatting
61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: SaveTransaction.sql
|
|
|
|
package store
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
)
|
|
|
|
const saveTransaction = `-- name: SaveTransaction :many
|
|
INSERT INTO transactions (x402_transaction_hash, amount, asset, network, recipient, sender)
|
|
VALUES ($1, $2, $3, $4, $5, $6)
|
|
RETURNING id, created_at
|
|
`
|
|
|
|
type SaveTransactionParams struct {
|
|
X402TransactionHash string
|
|
Amount string
|
|
Asset string
|
|
Network string
|
|
Recipient string
|
|
Sender string
|
|
}
|
|
|
|
type SaveTransactionRow struct {
|
|
ID int64
|
|
CreatedAt sql.NullTime
|
|
}
|
|
|
|
func (q *Queries) SaveTransaction(ctx context.Context, arg SaveTransactionParams) ([]SaveTransactionRow, error) {
|
|
rows, err := q.db.QueryContext(ctx, saveTransaction,
|
|
arg.X402TransactionHash,
|
|
arg.Amount,
|
|
arg.Asset,
|
|
arg.Network,
|
|
arg.Recipient,
|
|
arg.Sender,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []SaveTransactionRow
|
|
for rows.Next() {
|
|
var i SaveTransactionRow
|
|
if err := rows.Scan(&i.ID, &i.CreatedAt); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Close(); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|