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

use nimble_csv everywhere #4183

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

use nimble_csv everywhere #4183

wants to merge 2 commits into from

Conversation

ruslandoga
Copy link
Contributor

@ruslandoga ruslandoga commented Jun 4, 2024

Changes

This PR replaces https://github.com/beatrichartz/csv with https://github.com/dashbitco/nimble_csv as a more performant option (fewer binaries are created this way)

Tests

  • This PR does not require tests

Changelog

  • This PR does not make a user-facing change

Documentation

  • This change does not need a documentation update

Dark mode

  • This PR does not change the UI

@@ -154,6 +154,7 @@ defmodule PlausibleWeb.StatsController do
Map.keys(csvs)
|> Enum.zip(csv_values)
|> Enum.reject(fn {_k, v} -> is_nil(v) end)
|> Enum.map(fn {k, v} -> {k, IO.iodata_to_binary(v)} end)

{:ok, {_, zip_content}} = :zip.create(filename, csvs, [:memory])
Copy link
Contributor Author

@ruslandoga ruslandoga Jun 4, 2024

Choose a reason for hiding this comment

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

note to self: :zip.create doesn't support iodata, maybe it makes sense to use zstream here and send the export in chunks.

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.

None yet

1 participant