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

api: write a connection schema getter #355

Merged
merged 1 commit into from
Nov 24, 2023

Conversation

DerekBum
Copy link

@DerekBum DerekBum commented Nov 18, 2023

Write a helper function to load the actual schema for the user.

Previously we stored actual schema in a private schemaResolver field and Schema field was used only to get a current schema. But now because of the new function, we don't need to store the Schema as a different field. So Schema was also removed.

To update the schema, one needs to use GetSchema + SetSchema in pair. SetSchema(Schema) replacing the OverrideSchema(*Schema).

Spaces and SpacesById fields of the Schema struct store spaces by value.
Fields and FieldsById fields of the Space struct store fields by value. Index and IndexById fields of the Space struct store indexes by value.
Fields field of the Index struct store IndexField by value.

I didn't forget about (remove if it is not applicable):

Closes #7

Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

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

Apparently we had a misunderstanding.

I would like to see a separate public function that would returns the current-actual schema. It shouldn't return a schema used by the connection, but re-fetch an actual one. Something like Connection.loadSchema() in the current implementation.

CHANGELOG.md Outdated Show resolved Hide resolved
@DerekBum DerekBum force-pushed the DerekBum/gh-7-connection-schema-getter branch from 70fdc03 to 92fe8b5 Compare November 20, 2023 10:17
CHANGELOG.md Outdated Show resolved Hide resolved
example_test.go Outdated Show resolved Hide resolved
example_test.go Outdated Show resolved Hide resolved
schema.go Outdated Show resolved Hide resolved
schema.go Show resolved Hide resolved
schema.go Outdated Show resolved Hide resolved
schema.go Outdated Show resolved Hide resolved
connection.go Outdated Show resolved Hide resolved
@DerekBum DerekBum force-pushed the DerekBum/gh-7-connection-schema-getter branch 3 times, most recently from 66c5253 to 954c5b5 Compare November 20, 2023 11:36
@DerekBum DerekBum force-pushed the DerekBum/gh-7-connection-schema-getter branch 4 times, most recently from 663b54b to 7f0cffc Compare November 21, 2023 01:53
@oleg-jukovec oleg-jukovec requested a review from askalt November 21, 2023 07:21
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link

@askalt askalt left a comment

Choose a reason for hiding this comment

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

Hi, thanks for the patch! See small comments below.

Also, please fix typo in commit message:
used needs to use -> one needs to use .

tarantool_test.go Outdated Show resolved Hide resolved
tarantool_test.go Outdated Show resolved Hide resolved
Write a helper function to load the actual schema for the user.

Previously we stored actual schema in a private `schemaResolver`
field and `Schema` field was used only to get a current schema.
But now because of the new function, we don't need to store the
`Schema` as a different field. So `Schema` was also removed.

To update the schema, one needs to use `GetSchema` + `SetSchema`
in pair. `SetSchema(Schema)` replacing the `OverrideSchema(*Schema)`.

`Spaces` and `SpacesById` fields of the `Schema` struct store spaces by value.
`Fields` and `FieldsById` fields of the `Space` struct store fields by value.
`Index` and `IndexById` fields of the `Space` struct store indexes by value.
`Fields` field of the `Index` struct store `IndexField` by value.

Closes #7
@DerekBum DerekBum force-pushed the DerekBum/gh-7-connection-schema-getter branch from 7f0cffc to 03e6c25 Compare November 24, 2023 09:31
@oleg-jukovec oleg-jukovec removed the request for review from better0fdead November 24, 2023 10:16
@oleg-jukovec oleg-jukovec merged commit a0ce232 into master Nov 24, 2023
22 checks passed
@oleg-jukovec oleg-jukovec deleted the DerekBum/gh-7-connection-schema-getter branch November 24, 2023 10:27
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.

v2: soft automatic schema reload
3 participants