小编mic*_*arz的帖子

使用Angular 6和Karma进行随机测试失败

我们在CI管道中观察了随机业力测试.在每次运行中,不同的测试失败,有时它会通过,当它失败时会抛出此错误:

Uncaught TypeError: params.map is not a function thrown

有没有人受到类似的影响?

karma-jasmine angular angular6

6
推荐指数
1
解决办法
1897
查看次数

使用 postgresql 处理 EF core 中原始查询参数列表的正确方法

处理我需要包含在 WHERE IN 查询中的项目列表的正确方法是什么?在我的用例中,我需要使用日期时间列表。我当前的解决方案非常糟糕,因为我在查询中嵌入了数据,并且我更喜欢使用查询参数。

            var n = String.Join(",", dates.Select(item => $"'{item.ToString()}'::timestamp"));
            var q = $@"
SELECT c.date AS date, a.id AS user_id, a.user_name AS user_name, a.email AS user_email, COALESCE(sum(te.amount), 0) AS summary
FROM asp_net_users a
         CROSS JOIN (SELECT *
                     FROM calendar
                     WHERE date IN({n})
) c
         LEFT JOIN time_entries te on a.id = te.user_id AND c.date = te.date
WHERE a.department_guid = '95b7538d-3830-48d7-ba06-ad7c51a57191'
GROUP BY c.date, a.id
HAVING COALESCE(sum(te.amount), 0) > 480
ORDER BY c.date
";
Run Code Online (Sandbox Code Playgroud)

当我尝试在查询参数中使用日期作为数组时,我收到以下错误:

operator does not exist: …
Run Code Online (Sandbox Code Playgroud)

entity-framework asp.net-core

5
推荐指数
1
解决办法
1224
查看次数

使用Enum.map时在struct内设置值

让我们假设我有这样的结构:

results = %{page: page_numer, period: period, result: [%Entry{}, %Entry{}]}
Run Code Online (Sandbox Code Playgroud)

我想在result.result中的每个%Entry {}附加一些数据,就像它一样:

result.result
|> Enum.map(fn entry -> 
   entry.page = results[:page]
   entry.period = results[:period]
 end)
Run Code Online (Sandbox Code Playgroud)

可能吗?

elixir

1
推荐指数
1
解决办法
254
查看次数