Added documentation.

This commit is contained in:
Achim D. Brucker 2018-07-25 07:03:32 +01:00
parent d1b0a7d402
commit 8c0ef4ca8c
1 changed files with 51 additions and 11 deletions

View File

@ -19,19 +19,59 @@
namespace LogicalHacking.ExtensionDsLab.Archive
/// Queries realted to extensions. The return type of all queries
/// in this module should be `System.Linq.IQueryable<>` .
module ExtensionQueries =
open DbConnector
/// **Description**
///
/// Query returning historical download data (as reported by Google) for
/// for the extension specified by the extension id `extid` .
///
/// **Runtime Expectation**
///
/// *Fast*, this query is expected to take less than 2s.
///
/// **Parameters**
///
/// * `ctx` - current database context (type: `ExtensionDbType`)
/// * `extid` - id of the extension for which the download data
/// is obtained (type: `string`)
///
/// **Output Type**
///
/// * `System.Linq.IQueryable<System.DateTime * int>`
///
/// **Exceptions**
///
let getDownloads (ctx:ExtensionDbType) extid =
query {
for order in ctx.Extensions.Extension do
where (order.Extid = extid && order.Downloads.IsSome)
select (order.Date, order.Downloads.Value)
}
query {
for order in ctx.Extensions.Extension do
where (order.Extid = extid && order.Downloads.IsSome)
select (order.Date, order.Downloads.Value)
}
/// **Description**
///
/// Query for obtaining a list of all extension id stored in the database.
///
/// **Runtime Expectation**
///
/// *Slow*, this query can take several hours.
///
/// **Parameters**
///
/// * `ctx` - current database context (type: `ExtensionDbType`)
///
/// **Output Type**
/// * `System.Linq.IQueryable<string>`
///
/// **Exceptions**
///
let getAllExtIds (ctx:ExtensionDbType) =
query {
for ext in ctx.Extensions.Extension do
select ext.Extid
distinct
}
query {
for ext in ctx.Extensions.Extension do
select ext.Extid
distinct
}