(ctx context.Context, arg CountConnectionLogsParams, prepared rbac.PreparedAuthorized)
| 695 | } |
| 696 | |
| 697 | func (q *sqlQuerier) CountAuthorizedConnectionLogs(ctx context.Context, arg CountConnectionLogsParams, prepared rbac.PreparedAuthorized) (int64, error) { |
| 698 | authorizedFilter, err := prepared.CompileToSQL(ctx, regosql.ConvertConfig{ |
| 699 | VariableConverter: regosql.ConnectionLogConverter(), |
| 700 | }) |
| 701 | if err != nil { |
| 702 | return 0, xerrors.Errorf("compile authorized filter: %w", err) |
| 703 | } |
| 704 | filtered, err := insertAuthorizedFilter(countConnectionLogs, fmt.Sprintf(" AND %s", authorizedFilter)) |
| 705 | if err != nil { |
| 706 | return 0, xerrors.Errorf("insert authorized filter: %w", err) |
| 707 | } |
| 708 | |
| 709 | query := fmt.Sprintf("-- name: CountAuthorizedConnectionLogs :one\n%s", filtered) |
| 710 | rows, err := q.db.QueryContext(ctx, query, |
| 711 | arg.OrganizationID, |
| 712 | arg.WorkspaceOwner, |
| 713 | arg.WorkspaceOwnerID, |
| 714 | arg.WorkspaceOwnerEmail, |
| 715 | arg.Type, |
| 716 | arg.UserID, |
| 717 | arg.Username, |
| 718 | arg.UserEmail, |
| 719 | arg.ConnectedAfter, |
| 720 | arg.ConnectedBefore, |
| 721 | arg.WorkspaceID, |
| 722 | arg.ConnectionID, |
| 723 | arg.Status, |
| 724 | arg.CountCap, |
| 725 | ) |
| 726 | if err != nil { |
| 727 | return 0, err |
| 728 | } |
| 729 | defer rows.Close() |
| 730 | var count int64 |
| 731 | for rows.Next() { |
| 732 | if err := rows.Scan(&count); err != nil { |
| 733 | return 0, err |
| 734 | } |
| 735 | } |
| 736 | if err := rows.Close(); err != nil { |
| 737 | return 0, err |
| 738 | } |
| 739 | if err := rows.Err(); err != nil { |
| 740 | return 0, err |
| 741 | } |
| 742 | return count, nil |
| 743 | } |
| 744 | |
| 745 | type chatQuerier interface { |
| 746 | GetAuthorizedChats(ctx context.Context, arg GetChatsParams, prepared rbac.PreparedAuthorized) ([]GetChatsRow, error) |
nothing calls this directly
no test coverage detected