Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-2260

Tighten OperationSpec for lookupIn and mutateIn

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0-beta.4
    • 3.0.0
    • None
    • None
    • 1

    Description

      Right now both methods take an enumerable of OperationSpec, but I think they need to be tightened to the proper types allowed (likely enumerables of LookupInSpec and MutateInSpec)

      Attachments

        For Gerrit Dashboard: NCBC-2260
        # Subject Branch Project Status CR V

        Activity

          jmorris Jeff Morris added a comment - - edited

          It looks like this was implemented as a more generic CouchbaseCollection method that uses an enumerable of OperationSpecs

          public async Task<IMutateInResult> MutateInAsync(string id, IEnumerable<OperationSpec> specs, MutateInOptions options = null)
          

          And as more specific extension methods which take specific MutateInSpecBuilder and LookupInSpecBuilder Action methods (for lambda syntax):

          public static Task<IMutateInResult> MutateInAsync(this ICollection collection, string id, Action<MutateInSpecBuilder> configureBuilder)
          

          Which is used like this:

          var result = await collection.MutateInAsync("foo", specs =>
                          {
                              specs.Upsert("key", "value", true, true);
                              specs.Upsert("name", "mike");
                          },
                          options => options.WithStoreSemantics(StoreSemantics.Upsert));
                  }
          

          This is very C#/.NET idiomatic.

          jmorris Jeff Morris added a comment - - edited It looks like this was implemented as a more generic CouchbaseCollection method that uses an enumerable of OperationSpecs public async Task<IMutateInResult> MutateInAsync(string id, IEnumerable<OperationSpec> specs, MutateInOptions options = null) And as more specific extension methods which take specific MutateInSpecBuilder and LookupInSpecBuilder Action methods (for lambda syntax): public static Task<IMutateInResult> MutateInAsync(this ICollection collection, string id, Action<MutateInSpecBuilder> configureBuilder) Which is used like this: var result = await collection.MutateInAsync("foo", specs => { specs.Upsert("key", "value", true, true); specs.Upsert("name", "mike"); }, options => options.WithStoreSemantics(StoreSemantics.Upsert)); } This is very C#/.NET idiomatic.
          jmorris Jeff Morris added a comment -

          Michael Nitschinger - what do you think about ^?

          jmorris Jeff Morris added a comment - Michael Nitschinger - what do you think about ^?

          People

            daschl Michael Nitschinger
            daschl Michael Nitschinger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty