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

add compatibility with vscode tableviewer #510

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ version = "0.24.1"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
IteratorInterfaceExtensions = "82899510-4779-5014-852e-03e436cf321d"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TableTraits = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[compat]
Expand All @@ -23,6 +25,8 @@ Statistics = "1"
Tables = "1"
julia = "1.6"
PrettyTables = "2"
IteratorInterfaceExtensions = "1"
TableTraits = "1"

[extras]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
6 changes: 6 additions & 0 deletions src/tables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module TablesIntegration
using ..TimeSeries

using Tables
using TableTraits
using IteratorInterfaceExtensions


# S: the column names, including the extra column name for time index
Expand Down Expand Up @@ -63,6 +65,10 @@ Tables.schema(i::TableIter{T,S}) where {T,S} = Tables.Schema(S, coltypes(data(i)

coltypes(x::AbstractTimeSeries{T,N,D}) where {T,N,D} = (D, (T for _ ∈ 1:size(x, 2))...)

TableTraits.isiterabletable(x::TimeArray) = true
IteratorInterfaceExtensions.getiterator(ta::TimeArray) =
Tables.datavaluerows(Tables.columntable(ta))
IteratorInterfaceExtensions.isiterable(ta::TimeArray) = true

###############################################################################
# Constructors
Expand Down
Loading