This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GROUP AzureFunctions | |
STORAGE: NONE | |
RESTRICTION: == netcoreapp3.0 | |
NUGET | |
remote: https://api.nuget.org/v3/index.json | |
Braintree (4.16) | |
Newtonsoft.Json (>= 9.0.1) | |
System.Xml.XPath.XmlDocument (>= 4.3) | |
ExcelDataReader (3.6) | |
FSharp.Core (4.7) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group AzureFunctions | |
source https://api.nuget.org/v3/index.json | |
framework: netcoreapp3.0 | |
storage: none | |
nuget FSharp.Core | |
nuget Microsoft.NET.Sdk.Functions | |
nuget Microsoft.Azure.WebJobs.Extensions.Storage | |
nuget Microsoft.AspNetCore.Mvc | |
nuget WindowsAzure.Storage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let myFun fmt = | |
Printf.ksprintf (fun text -> | |
text.Replace("1","one").Replace("2","two") // <- this is naive | |
) fmt | |
let newText = myFun "%d-%d" 1 2 | |
printfn "%s" newText |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SocketStop | |
open Microsoft.Azure.WebJobs | |
open System.Net.Http | |
open FSharp.Control.Tasks.ContextInsensitive | |
open Microsoft.Azure.WebJobs.Extensions.Http | |
open Microsoft.Extensions.Logging | |
open Microsoft.AspNetCore.Mvc | |
[<FunctionName("SocketStop")>] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec getNextInvoiceNo (table:CloudTable) operatorID = task { | |
let rowKey = "invoiceno" | |
let query = TableOperation.Retrieve(operatorID, rowKey) | |
let! r = table.ExecuteAsync(query) | |
if r.HttpStatusCode <> 200 || isNull r.Result then | |
let entity = DynamicTableEntity() | |
entity.PartitionKey <- operatorID | |
entity.RowKey <- rowKey | |
let no = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let queue1 = // .. | |
let chunkSize = 100 | |
[<FunctionName("Start")>] | |
let run([<QueueTrigger("start")>]content:string, log:ILogger) = | |
let t = task { | |
let msgs = | |
[1..5000] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let queue = // .. | |
[<FunctionName("MyFunction")>] | |
let run([<QueueTrigger("start")>]content:string, log:ILogger) = | |
let t = task { | |
let! _ = | |
[1..5000] | |
|> Seq.map (fun _ -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let queue = // .. | |
[<FunctionName("MyFunction")>] | |
let run([<QueueTrigger("start")>]content:string, log:ILogger) = | |
let t = task { = | |
for i in 1 .. 5000 do | |
let message = CloudQueueMessage(Newtonsoft.Json.JsonConvert.SerializeObject msg) | |
do! queue.AddMessageAsync(message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let allTagsEndpoint = | |
pipeline { | |
plug (fun next ctx -> task { | |
let txt = TagList.Encoder tags |> Encode.toString 0 | |
ctx.SetContentType ("application/json") | |
return! setBodyFromString txt next ctx | |
}) | |
set_header "Content-Type" "application/json" | |
} |