public/Message/Measure-Cardinality.ps1
using module '..\..\modules\Enums.psm1' using module '..\..\modules\Helper\DateTimeHelper.psm1' using module '..\..\modules\Helper\StringHelper.psm1' using module '..\..\modules\Helper\ObjectHelper.psm1' using module '..\..\modules\Session.psd1' using module '..\..\modules\FeedProcessor\Auditlog\Message.psm1' function Measure-Cardinality{ [CmdletBinding()] [Alias('msc')] param( [Parameter(ValueFromPipeline=$true, Mandatory=$true)] [Message] $message, [int]$groupByMinutes = $null ) BEGIN { [Message[]] $allMessages = @() } PROCESS { if ($groupByMinutes) { $allMessages += $message } else{ $message.cardinality.group = $message.createdAt Write-Output $message.cardinality } } END { Write-Output ([Message]::CardinalityGroupByMinute($allMessages, $groupByMinutes)) } } |