这是indexloc提供的服务,不要输入任何密码
Skip to content

Update to ndc-spec v0.1.5 and ndc-sdk-rs v0.2.1 #86

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

Merged
merged 15 commits into from
Jul 11, 2024

Conversation

dmoverton
Copy link
Contributor

@dmoverton dmoverton commented Jul 9, 2024

Describe your changes

Update to latest ndc-spec and sdk

@dmoverton dmoverton marked this pull request as draft July 9, 2024 12:57
@dmoverton dmoverton self-assigned this Jul 9, 2024
@dmoverton dmoverton changed the title Update to ndc-spec v0.1.5 and ndc-sdk-rs v0.2.0 Update to ndc-spec v0.1.5 and ndc-sdk-rs v0.2.1 Jul 11, 2024
@dmoverton dmoverton requested a review from hallettj July 11, 2024 01:31
@dmoverton dmoverton marked this pull request as ready for review July 11, 2024 04:55
@dmoverton dmoverton enabled auto-merge (squash) July 11, 2024 05:28
Copy link
Collaborator

@hallettj hallettj left a comment

Choose a reason for hiding this comment

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

This is very helpful, thanks for all this work!

@@ -69,13 +69,15 @@ impl From<Type> for ndc_models::Type {
// ExtendedJSON can respresent any BSON value, including null, so it is always nullable
Type::ExtendedJSON => ndc_models::Type::Nullable {
underlying_type: Box::new(ndc_models::Type::Named {
name: mongodb_support::EXTENDED_JSON_TYPE_NAME.to_owned(),
name: mongodb_support::EXTENDED_JSON_TYPE_NAME.to_owned().into(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think for cases like this we might avoid heap allocation with something like,

TypeName(SmolStr::new_static(mongodb_support::EXTENDED_JSON_TYPE_NAME))

That would be a bit easier if the ndc-models newtype macro added implementations for From SmolStr or From &'static str. But it looks like the ref-cast crate helps to fill that gap?

This is absolutely not worth you spending time on making changes. I'm commenting only because I enjoy the allocation golf thought exercises.

@@ -28,7 +28,7 @@ impl AggregationFunction {
all::<AggregationFunction>()
.find(|variant| variant.graphql_name() == s)
.ok_or(QueryPlanError::UnknownAggregateFunction {
aggregate_function: s.to_owned(),
aggregate_function: s.to_owned().into(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like we should at least add a From &'a str to newtype

@dmoverton dmoverton merged commit 84c9a6d into main Jul 11, 2024
1 check passed
@dmoverton dmoverton deleted the dmoverton/ndc-spec-v0.1.5 branch July 11, 2024 20:29
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