Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated for Crystal 0.35.1 #12

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

vectorselector
Copy link

@vectorselector vectorselector commented Nov 9, 2020

Hello, I updated this shard for Crystal 0.35.1
Basically, the JSON.mapping is out, and it's now just extending each class with JSON::Serializable

I added one more method for creating a document with a custom (out of band) ID, which I need for my work:

    def create_document_custom_id(database, object, id) : Response::DocumentStatus
      Response::DocumentStatus.from_json(
        put(URL::DOC % {database, id}, body: object.to_json)
      )
    end 

I confess to not having added a unit test for this method, which I will do at some point.

added extra method to be able to create document with custom (externally generated) ID. 
 
create_document_custom_id(database, object, id)
updated to work with crystal 0.35.1
Error: no overload matches 'Int32.to_json' with type JSON::Builder ... IDK...
fine, just waste space then..
Deprecated JSON.mapping. use JSON::Serializable instead
@vectorselector vectorselector changed the title I think I updated this for Crystal 0.35.1 ? updated for Crystal 0.35.1 Dec 30, 2020
"sort" takes an array of  EITHER a String or an object as such [{"fieldname1": "desc"}, {"fieldname2": "asc"}] per CouchDB docs
https://docs.couchdb.org/en/2.3.1/api/database/find.html#sort-syntax
added example
oops. version needs to match release
crystal 1.0.0 update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant