Skip to content

Parameterized from_string tracks output params#451

Open
villagestevers wants to merge 1 commit intomainfrom
stevers/maybe-params
Open

Parameterized from_string tracks output params#451
villagestevers wants to merge 1 commit intomainfrom
stevers/maybe-params

Conversation

@villagestevers
Copy link
Copy Markdown
Member

Also move to using CustomResult for from_string.

A future change will call this when a constant string is used.

Updates internal types, external to follow.

Updates #449

Also move to using CustomResult for from_string.

A future change will call this when a constant string is used.

Updates internal types, external to follow.
size_t byte_size = static_cast<size_t>(p.dimension) * p.bytes_per_elem;
if (buf.size() < byte_size) return true;

//
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this blank line.

if (*s == ',') s++;
}
if (*s != ']') {
out.warning("tvector_from_string: missing ']'");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a test that these warnings/errors work correctly? If so, this is a real step for the better!

// =============================================================================

// Encode: string -> binary. false=success, true=error. SIZE_MAX length = NULL.
using TypeEncodeFunc = bool (*)(std::string_view from, Span<unsigned char> buf,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should keep the old signatures around and handle them, until you migrate vsql-cube and vsql-vector

using TypeEncodeWithParamsFunc = bool (*)(const P &, std::string_view from,
Span<unsigned char> buf,
size_t *length);
using TypeEncodeWithParamsFunc = void (*)(MaybeParams<P> &,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that CustomResultWith

would be the thing that would have the MaybeParams. I guess I was thinking that there would be some kind of symmetry with other functions that couldn't return their type params. But now that I think about it, that doesn't make much sense. If we don't want them to use the out.params(), maybe we should only support the CustomResult?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants