Skip to content

feature: search cbor for an element at a given (JSON pointer like) path #736

@elv-gilles

Description

@elv-gilles

Is your feature request related to a problem?
In the use case I'm working on, data is stored in a single CBOR structure.

Users provide input data via a REST API (as JSON) which is stored at conventional location(s) in the global structure.
Server processes then need to retrieve (and potentially modify) these data and/or create new one, also added in the structure.
This results in semi-large to large data.

The data flow currently consists in:

  • decoding the global structure into a generic map[string]interface{}
  • retrieving the sub-tree in the generic structure that corresponds to the specifics of the process via a JSON-pointer-like parameter
  • decode the sub-tree into the actually needed go structs via mapstructure (or other means, including re-encoding into json followed by json unmarshaling)

Describe the solution you'd like
It would be more efficient to be able to locate the sub-tree in cbor and decode into structs from there

Solution would be a function Search(keys []string) (offset int, err error) allowing to decode the element at the returned offset.

Describe alternatives you've considered
see description

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions