// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.28.0 // source: trusted_and_blocked_users.sql package data import ( "context" "crypto/ed25519" "github.com/kyren223/eko/pkg/snowflake" ) const getTrustedPublicKey = `-- name: GetTrustedPublicKey :one SELECT trusted_public_key FROM trusted_users WHERE trusting_user_id = ? AND trusted_user_id = ? ` type GetTrustedPublicKeyParams struct { TrustingUserID snowflake.ID TrustedUserID snowflake.ID } func (q *Queries) GetTrustedPublicKey(ctx context.Context, arg GetTrustedPublicKeyParams) (ed25519.PublicKey, error) { row := q.db.QueryRowContext(ctx, getTrustedPublicKey, arg.TrustingUserID, arg.TrustedUserID) var trusted_public_key ed25519.PublicKey err := row.Scan(&trusted_public_key) return trusted_public_key, err } const getUserTrusteds = `-- name: GetUserTrusteds :many SELECT trusted_user_id, trusted_public_key FROM trusted_users WHERE trusting_user_id = ? ` type GetUserTrustedsRow struct { TrustedUserID snowflake.ID TrustedPublicKey ed25519.PublicKey } func (q *Queries) GetUserTrusteds(ctx context.Context, trustingUserID snowflake.ID) ([]GetUserTrustedsRow, error) { rows, err := q.db.QueryContext(ctx, getUserTrusteds, trustingUserID) if err != nil { return nil, err } defer rows.Close() var items []GetUserTrustedsRow for rows.Next() { var i GetUserTrustedsRow if err := rows.Scan(&i.TrustedUserID, &i.TrustedPublicKey); 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 } const trustUser = `-- name: TrustUser :exec INSERT OR IGNORE INTO trusted_users ( trusting_user_id, trusted_user_id, trusted_public_key ) VALUES (?, ?, ?) ` type TrustUserParams struct { TrustingUserID snowflake.ID TrustedUserID snowflake.ID TrustedPublicKey ed25519.PublicKey } func (q *Queries) TrustUser(ctx context.Context, arg TrustUserParams) error { _, err := q.db.ExecContext(ctx, trustUser, arg.TrustingUserID, arg.TrustedUserID, arg.TrustedPublicKey) return err } const untrustUser = `-- name: UntrustUser :exec DELETE FROM trusted_users WHERE trusting_user_id = ? AND trusted_user_id = ? ` type UntrustUserParams struct { TrustingUserID snowflake.ID TrustedUserID snowflake.ID } func (q *Queries) UntrustUser(ctx context.Context, arg UntrustUserParams) error { _, err := q.db.ExecContext(ctx, untrustUser, arg.TrustingUserID, arg.TrustedUserID) return err }