Comments (6)
Greg, thats a complete pain. I've checked the ecto source at the error and its not particularly illuminating.
The underlying change is that I changed the Money.Ecto.Composite.Type
to a parameterised type which is supported in Ecto ~> 3.5 and therefore allows defaults which is a good thing. However it introduced an incompatibility I wasn't aware of until after I published the new release of ex_money_sql
.
To my knowledge, the only area that might be causing this exception is if you are calling the type
macro to cast database values in a schemaless query. Any chance that could be the issue for you? If you are using type/2
in schemaless queries there is a change to the call that needs to be made. Basically is needs to be of the form of this example from the tests:
type(sum(organization.payroll), ^Money.Ecto.Composite.Type.cast_type())
If thats not it then hopefully you can help me with a minimal failing test and I can dig into it further.
from money_sql.
BTW, the original issue filed that links to the discussion on the ecto repo is here
from money_sql.
Ah, I'm doing this:
where(Credit, [c], c.price < type(^value, Money.Ecto.Composite.Type))
Could this be what you are referring to?
Credit
is a normal ecto schema..
from money_sql.
Thank you for this lead - while I couldn't get your example to work (something needs a force recompile that I can't pinpoint) doing it myself money_type = Ecto.ParameterizedType.init(Money.Ecto.Composite.Type, [])
and using that DID work. Appreciate it!
from money_sql.
@coladarci, thanks for the update Greg. I see that I haven't documented this nearly well enough. I do note that you should (as best I understand it) be able to do:
where(Credit, [c], c.price < type(^value, c.price))
Which removes any requirement to understand the deeper plumbing.
from money_sql.
Oh wow - I had no idea you could do this... that does work...
from money_sql.
Related Issues (20)
- `undefined function migrations_path/1` when attempting to compile HOT 3
- Ecto types return malformed error when casting invalid currency HOT 2
- Dependencie issue with ex_money 5.2 HOT 2
- Not compatible with Decimal 2.0 HOT 7
- Unmatched clause for `Cldr.Decimal.parse/1` HOT 1
- Composite type cast does not respect locales HOT 5
- Possible bug in ecto? Asking here first for clarification HOT 3
- Broken/Unsupported CompositeType defaults
- Checking if I receive notifications
- function Money.Ecto.Composite.Type.type/0 is undefined or private when using Ecto.Query.Api.type/2 HOT 7
- Add keyword list to error return from money_with_currency cast/1 HOT 3
- Add Ecto Changeset validations HOT 1
- Aggregate function treating null as zero amount HOT 1
- Is it able to change the behavior of to_string for `Money.Ecto.Composite.Type` ? HOT 7
- Cast function used to return error when currency is nil HOT 2
- Money.Ecto.Map.Type.embed_as/2 should return :dump instead of :self HOT 2
- Protocol.UndefinedError exception for Jason.Encoder when embedded schema is configured incorrectly with Money.Ecto.Composite.Type HOT 8
- Sum returns ERROR 42804 (datatype_mismatch) HOT 7
- Could not read file error after upgrading to 1.10.0 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from money_sql.