anykeyh / clear

Advanced ORM between postgreSQL and Crystal

Home Page:https://github.com/anykeyh/clear

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when requiring "clear" in Crystal 1.1.1

Lunari8546 opened this issue · comments

commented

I'm using Crystal 1.1.1 and when I require "clear" I got this error.

In lib/clear/src/clear/sql/insert_query.cr:61:10

 61 | h[col] = rs.read
       ^
Error: no overload matches 'Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | BigDecimal | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)#[]=' with types String, (Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) 
| Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Bool | Char | Float32 | Float64 | Int16 | Int32 | Int64 | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt32 | UUID | Nil)

Overloads are:
 - Hash(K, V)#[]=(key : K, value : V)
Couldn't find overloads for these types:
 - Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | BigDecimal | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)#[]=(key : String, value : JSON::PullParser)

Here's my shard.lock :

version: 2.0
shards:
  admiral:
    git: https://github.com/jwaldrip/admiral.cr.git
    version: 1.12.1

  clear:
    git: https://github.com/anykeyh/clear.git
    version: 0.9+git.commit.775e877c4f961da01fa621ae7ca302cb735198df

  db:
    git: https://github.com/crystal-lang/crystal-db.git
    version: 0.10.1

  exception_page:
    git: https://github.com/crystal-loot/exception_page.git
    version: 0.1.5

  generate:
    git: https://github.com/anykeyh/generate.cr.git
    version: 0.1.0+git.commit.f5dafc934a70e0ee2f246dddf3df44686f844da2

  graphql:
    git: https://github.com/graphql-crystal/graphql.git
    version: 0.3.1

  inflector:
    git: https://github.com/anykeyh/inflector.cr.git
    version: 0.1.8+git.commit.dc5c898b0a834617d8b3ff73ac5a2239bd9fc019

  kemal:
    git: https://github.com/kemalcr/kemal.git
    version: 1.0.0

  kilt:
    git: https://github.com/jeromegn/kilt.git
    version: 0.4.1

  pg:
    git: https://github.com/will/crystal-pg.git
    version: 0.24.0

  radix:
    git: https://github.com/luislavena/radix.git
    version: 0.4.1

This looks like #190 but that should be fixed with clear 0.9.0.

I'm getting the same error and think it's actually coming from this recent change to pg. In my local fork of clear, adding JSON::PullParser to the Clear::SQL::Any type (here) fixes the compiler errors, but I'm getting errors when running tests (which can very much be due to incorrect environment set up, I haven't dug very far yet). Posting this here in case I don't find time to finish digging into this and submitting a PR.

Ah, did find time tonight to track down the remaining issues. Created PR: #220

same error: crystal 1.3.2

  clear:
    git: https://github.com/anykeyh/clear.git
    version: 0.9+git.commit.480289555c833793fa6964398fefec6b7e25168d

require clear

Showing last frame. Use --error-trace for full trace.

In lib/clear/src/clear/sql/insert_query.cr:61:10

 61 | h[col] = rs.read
       ^
Error: no overload matches 'Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | BigDecimal | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)#[]=' with types String, (Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | Bool | Char | Float32 | Float64 | Int16 | Int32 | Int64 | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt32 | UUID | Nil)                                                 

Overloads are:
 - Hash(K, V)#[]=(key : K, value : V)
Couldn't find overloads for these types:
 - Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | BigDecimal | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)#[]=(key : String, value : Array(PG::UUIDArray))

Actually fixed if i freeze pg, with such yml it works.

  clear:
    github: anykeyh/clear
    branch: master
  pg:
    github: will/crystal-pg
    version: 0.24.0

I have a fix for this change in my own fork here: https://github.com/Vici37/clear

You can temporarily use it instead of freezing pg in your shards.yml via:

  clear:
    github: Vici37/clear
    branch: master

Once #220 #225 gets merged into this repo, it's safe to swap this back (I try to keep my own fork's master branch up to date as well, though).

commented

any update on this issue?