Skip to content

Commit f10d4fb

Browse files
authored
Merge pull request #5 from queryverse/readonlyarrays
Use ReadOnlyArrays
2 parents 85f47c1 + 6bfe057 commit f10d4fb

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ version = "0.1.1-DEV"
66
DataValues = "e7dc6d0d-1eca-5fa6-8ad6-5aecde8b7ea5"
77
TableShowUtils = "5e66a065-1f0a-5976-b372-e0b8c017ca10"
88
TableTraitsUtils = "382cd787-c1b6-5bf2-a167-d5b971a19bda"
9+
ReadOnlyArrays = "988b38a3-91fc-5605-94a2-ee2116b3bd83"
910

1011
[extras]
1112
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
@@ -18,3 +19,4 @@ DataValues = "0.4.7"
1819
TableShowUtils = "0.2.2"
1920
TableTraitsUtils = "0.4, 1"
2021
julia = "1"
22+
ReadOnlyArrays = "0.1.1"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ To access an individual column by name, use the `.` dot syntax:
3535

3636
```julia
3737
julia> dt.Age
38-
3-element Array{Float64,1}:
38+
3-element ReadOnlyArrays.ReadOnlyArray{Float64,1,Array{Float64,1}}:
3939
23.0
4040
43.0
4141
56.0

src/QueryTables.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module QueryTables
22

3-
import TableShowUtils, TableTraitsUtils
3+
import TableShowUtils, TableTraitsUtils, ReadOnlyArrays
44

55
using DataValues
66

@@ -11,6 +11,7 @@ struct DataTable{T, TCOLS} <: AbstractVector{T}
1111
end
1212

1313
function fromNT(nt)
14+
nt = map(i->i isa ReadOnlyArrays.ReadOnlyArray ? i : ReadOnlyArrays.ReadOnlyArray(i), nt)
1415
tx = typeof(nt)
1516
et = NamedTuple{propertynames(nt), Tuple{(eltype(fieldtype(tx, i)) for i in 1:fieldcount(typeof(nt)))...}}
1617
return DataTable{et, typeof(nt)}(nt)

0 commit comments

Comments
 (0)