fsprojects / FSharp.Azure.Storage

F# API for using Microsoft Azure Table Storage service
MIT License
75 stars 16 forks source link

FSharp.AWS.DynamoDB: lessons learned #25

Open eiriktsarpalis opened 8 years ago

eiriktsarpalis commented 8 years ago

I spent the past few months working on FSharp.AWS.DynamoDB, a library directly influenced by FSharp.Azure.Storage. Even though DynamoDB is a different beast to Azure's Table Storage, I experimented with a few features that I think could also be incorporated in the current library:

Serializer Attributes

Drawing from this issue, I have adopted a design where where particular serializer implementations can inherit from an abstract attribute base class. Defining query expressions that access serialized properties result in client-side errors.

Additional Primitive Support

Primitive support could be extended to encompass more primitives, including uint16, decimal, enumerations, System.TimeSpan, System.Nullable, etc. c.f. #15.

Getting a specific entity

On quick inspection it looks like the library is missing a get implementation which takes an EntityIdentifier and returns the corresponding record from store.

Update Expressions

Using quoted update expressions should allow for more flexible merge operations, which do not necessarily replace all record fields. The update message could look something like this:

type Operation<'T> =
     ...
     | MergePartial of key:EntityIdentifier * uexpr:Expr<'T -> 'T> * etag:string

c.f #16

Integrate table metadata into Record

It would be possible to integrate table metadata directly into the user-supplied record. For example:

type Entity =
    {
          ...
          [<ETag>] ETag : string option
          [<TimeStamp>] TimeStamp : DateTimeOffset option   
    }

I will probably have time to work on contributing some of those changes, if they are agreeable to you.

daniel-chambers commented 8 years ago

That sounds great, I'd love to see any PRs you have time for for those features. The update expressions idea is particularly cool!