标签: marten

F#:将seq <'A>转换为seq <'B>的最快方法

我正在将Marten用作事件存储,尤其是要获取事件流。

type AccountCreation = {
    Owner: string
    AccountId: Guid
    CreatedAt: DateTimeOffset
    StartingBalance: decimal
}

type AccountEvents =
    | AccountCreated of AccountCreation
    | AccountCredited of Transaction
    | AccountDebited of Transaction

let settings = {
    Host = "localhost"
    DatabaseName = "postgres"
    UserName = "root"
    Password = "root"
    EventTypes = eventTypes
}
use store = createDocumentStore settings
use session = store.LightweightSession()

let khalidId = Guid.NewGuid()
let billId = Guid.NewGuid()

let khalid = AccountEvents.AccountCreated({
    Owner = "Khalid Abuhakmeh"
    AccountId = khalidId
    StartingBalance = 1000m …
Run Code Online (Sandbox Code Playgroud)

f# casting marten

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

标签 统计

casting ×1

f# ×1

marten ×1