-
Notifications
You must be signed in to change notification settings - Fork 30
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
[bigquery] Add scaffolding for the Storage Write API #720
[bigquery] Add scaffolding for the Storage Write API #720
Conversation
// Structs from relational and Mongo are different. | ||
// MongoDB will return the native objects back such as `map[string]any{"hello": "world"}` | ||
// Relational will return a string representation of the struct such as `{"hello": "world"}` | ||
func EncodeStructToJSONString(value any) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need this for the Storage Write API.
ProjectID string `yaml:"projectID"` | ||
Location string `yaml:"location"` | ||
BatchSize int `yaml:"batchSize"` | ||
UseStorageWriteAPI bool `yaml:"__useStorageWriteAPI"` // Not officially supported yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For config settings that are not intended for production use I think it's nice to prefix them with "__" to indicate that the are not officially supported, that way we can get rid of them without breaking backwards compatibility and having to bump the minor version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm% c
|
||
stringValue := string(bytes) | ||
if strings.Contains(stringValue, constants.ToastUnavailableValuePlaceholder) { | ||
slog.Error("encoded JSON value contains the toast unavailable value placeholder") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should return this too
return fmt.Sprintf(`{"key":"%s"}`, constants.ToastUnavailableValuePlaceholder), nil
Breaking out some parts of the Storage Write API PR I'm working out.