@@ -42,7 +42,7 @@ Tables.rows(t::TableSelection) = SelectionRows(t)
42
42
Tables. columnnames (t:: TableSelection ) = t. names
43
43
44
44
function Tables. getcolumn (t:: TableSelection , i:: Int )
45
- i > t. ncols && error (" Table has no column with index $i ." )
45
+ 1 ≤ i ≤ t. ncols || error (" Table has no column with index $i ." )
46
46
Tables. getcolumn (t. cols, t. mapnames[t. names[i]])
47
47
end
48
48
@@ -100,6 +100,7 @@ Base.IteratorEltype(::Type{<:SelectionRow}) = Base.EltypeUnknown()
100
100
# Indexing interface
101
101
Base. firstindex (:: SelectionRow ) = 1
102
102
Base. lastindex (row:: SelectionRow ) = row. ncols
103
+ Base. eachindex (row:: SelectionRow ) = 1 : row. ncols
103
104
Base. getindex (row:: SelectionRow , i:: Int ) = Tables. getcolumn (row, i)
104
105
105
106
# Tables.jl row interface
@@ -134,14 +135,15 @@ end
134
135
Base. iterate (s:: SelectionRows , state:: Int = 1 ) =
135
136
state > s. nrows ? nothing : (s[state], state + 1 )
136
137
137
- Base. length (row :: SelectionRows ) = row . nrows
138
+ Base. length (s :: SelectionRows ) = s . nrows
138
139
Base. eltype (:: Type{SelectionRows{T}} ) where {T} = SelectionRow{T}
139
140
Base. IteratorSize (:: Type{<:SelectionRows} ) = Base. HasLength ()
140
141
Base. IteratorEltype (:: Type{<:SelectionRows} ) = Base. HasEltype ()
141
142
142
143
# Indexing interface
143
144
Base. firstindex (:: SelectionRows ) = 1
144
145
Base. lastindex (s:: SelectionRows ) = s. nrows
146
+ Base. eachindex (s:: SelectionRows ) = 1 : s. nrows
145
147
Base. getindex (s:: SelectionRows , i:: Int ) = SelectionRow (s. selection, i)
146
148
147
149
# Tables.jl interface
0 commit comments