Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-2121

Grouping common attributes of InsertOptions, ReplaceOptions and UpsertOptions

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None
    • None
    • 0

    Description

      Hi
       
      I think it would be interesting to group common attributes of save operations (InsertOptions.java, ReplaceOptions.java and UpsertOptions.java). This new class would extend CommonDurabilityOptions.
      The main reason, besides simplicity, is that in spring-data-couchbase, at repository layer, you can do the following:
       

      @Repository
      public interface AirlineRepository extends CouchbaseRepository<Airline, String>, DynamicProxyable<AirlineRepository> {..}

       
       
       

      @Test public void testExpiration() { Airport airport = new Airport("1", "iata21", "icao21"); airportRepository.withOptions(InsertOptions.insertOptions().expiry(Duration.ofSeconds(10))).save(airport); Airport foundAirport = airportRepository.findByIata(airport.getIata()); assertNotEquals(0, foundAirport.getExpiration()); airportRepository.delete(airport); }

       
       
      In that layer, knowing whether to use InsertOptions, ReplaceOptions or UpsertOptions is not straightforward so it would be nice to at least use a common object for the save options (in principle the properties would be expiry and transcoder).
       
      How do you see it?
       
      Thank you very much in advance

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              michael.reiche Michael Reiche
              jorgerma Jorge Rodríguez
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty