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

make it easier to work with metadata by providing more default behaviors #56

Merged
merged 10 commits into from
Nov 9, 2022
15 changes: 7 additions & 8 deletions src/DataAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ the `key`.
$STYLE_INFO

The returned dictionary may be freshly allocated on each call to `metadata` and
is considered to be owned by `x` so it should be only used for reading data.
is considered to be owned by `x` so it must not be modified.
"""
function metadata(x::T; style::Bool=false) where {T}
if !metadatasupport(T).read
Expand Down Expand Up @@ -429,7 +429,11 @@ function colmetadata end
"""
colmetadata(x, [col]; style::Bool=false)

Return a dictionary mapping all column metadata keys to metadata values
If `col` is not passed return a dictionary mapping columns represented as
`Symbol` that have associated metadata to dictionaries mapping all
metadata keys to metadata values associated with table `x` for a given column.

If `col` is passed a dictionary mapping all column metadata keys to metadata values
bkamins marked this conversation as resolved.
Show resolved Hide resolved
associated with column `col` of table `x`. Throw an error if `x` does not
support reading metadata for column `col` or column `col` is not present in `x`.

Expand All @@ -439,13 +443,8 @@ the `key`.

$STYLE_INFO

If `col` is not passed return a dictionary mapping columns represented as
`Symbol` that have associated metadata to dictionaries dictionary mapping all
metadata keys to metadata values associated with table `x` for a given column.

The returned dictionary may be freshly allocated on each call to `colmetadata`
and is considered to be owned by `x` so it should be only used for reading
data.
and is considered to be owned by `x` so it must not be modified.
"""
function colmetadata(x::T, col; style::Bool=false) where {T}
if !colmetadatasupport(T).read
Expand Down