40 lines
1.9 KiB
Forth
40 lines
1.9 KiB
Forth
(*
|
|
* This file is part of the ExtensionDsLab project.
|
|
* Copyright (c) 2017 LogicalHacking.com
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, version 3.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*)
|
|
|
|
namespace LogicalHacking.ExtensionDsLab.Archive
|
|
|
|
module ExtensionQueries =
|
|
open DbConnector
|
|
|
|
let getDownloads (ctx:ExtensionDbType) extid =
|
|
query {
|
|
for order in ctx.Extensions.Extension do
|
|
where (order.Extid = extid)
|
|
select (order.Date, order.Downloads)
|
|
} |> Seq.filter (fun (_, download) -> download.IsSome)
|
|
|> Seq.map (fun (date, download) -> (date,
|
|
download.Value))
|
|
|
|
let getAllExtIds (ctx:ExtensionDbType) =
|
|
query {
|
|
for ext in ctx.Extensions.Extension do
|
|
select ext.Extid
|
|
distinct
|
|
}
|