Giter Club home page Giter Club logo

composite's People

Contributors

freevova avatar fuelen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

freevova

composite's Issues

Add on_ignore option

so we can write code like this

|> Composite.param(
  :order,
  fn
    query, :department_name_asc ->
      query |> order_by([departments: departments], asc: departments.name)

    query, :username_asc ->
      query |> order_by(asc: :name)
  end,
  on_ignore: &order_by(&1, :inserted_at)
)

Protocol Ecto.Queryable not implemented for %Composite{}

Getting a strange behavior where the query created with Composite will fail randomly with the error

** (Protocol.UndefinedError) protocol Ecto.Queryable not implemented for %Composite{...}

This does not happen always, but instead randomly without any change in the code. Perhaps the apply function is not being applied automatically?

My query is created as follows:

    Schema
    |> Composite.new(params)
    |> Composite.param([:param1], &filter_by_param1/2)
    |> Composite.param([:param2], &filter_by_param2/2, requires: :schema2)
    |> Composite.dependency(:plan, &join_schema2/1)
    |> Repo.all()

To reiterate, this is working in some cases and some cases is not. There isn't any change between successful and unsuccessful runs.

I'm using composite 0.4.3.

Allow primary functions with arity 1

Currently, we have the following API

|> Composite.param(:include_empty, fn query, _ -> query end,
  ignore?: &(&1 != true),
  on_ignore: &only_nonempty/1
)

The new idea is to allow functions with arity 1, so instead of fn query, _ -> query end, where passed parameter is not used, we can write &Function.identity/1 or &(&1).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.