Skip to content

Commit

Permalink
count refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Jun 7, 2022
1 parent d3effe1 commit d6c4d26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SearchLight"
uuid = "340e8cb6-72eb-11e8-37ce-c97ebeb32050"
authors = ["Adrian Salceanu <[email protected]>"]
version = "2.3"
version = "2.3.1"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
4 changes: 3 additions & 1 deletion src/SearchLight.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ include("Callbacks.jl")

export find, findone
export rand, randone
export all, count # min, max, mean, median
export all # min, max, mean, median
export findone_or_create, createwith, updateby_or_create, update_or_create
export save, save!, save!!, updatewith!, updatewith!!
export deleteall, delete
Expand Down Expand Up @@ -193,6 +193,8 @@ function Base.last(m::Type{T}; order = SQLOrder(pk(m), :desc))::Union{Nothing,T}
find(m, SQLQuery(order = order, limit = 1)) |> onereduce
end

function count end

function Base.count(m::Type{T}; where_conditions...)::Int where {T<:AbstractModel}
SearchLight.count(m, SQLQuery(where = [SQLWhereExpression("$(SQLColumn(x)) = ?", y) for (x,y) in where_conditions]))
end
Expand Down

4 comments on commit d6c4d26

@essenciary
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/61925

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.3.1 -m "<description of version>" d6c4d26e8f29950787c20ad34d0fc9509b75cc93
git push origin v2.3.1

Also, note the warning: Version 2.3.1 skips over 2.3.0
This can be safely ignored. However, if you want to fix this you can do so. Call register() again after making the fix. This will update the Pull request.

@essenciary
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/61925

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.3.1 -m "<description of version>" d6c4d26e8f29950787c20ad34d0fc9509b75cc93
git push origin v2.3.1

Please sign in to comment.