-
Notifications
You must be signed in to change notification settings - Fork 1
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
Optimistic Locking Support; SDK Parity #11
Conversation
Records can only be created via the Write method; removed the NewRecord method.
156a2d6
to
dc0f45d
Compare
client.go
Outdated
@@ -77,6 +77,7 @@ type Meta struct { | |||
Plain map[string]string `json:"plain"` | |||
Created time.Time `json:"created"` | |||
LastModified time.Time `json:"last_modified"` | |||
Version string `json:"version,omitempty"` |
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.
gofmt ... please align struct definitions.
client.go
Outdated
return &Record{ | ||
// Write writes a new encrypted record to the database. Returns the new record (with | ||
// the original, unencrypted data) | ||
func (c *Client) Write(ctx context.Context, recordType string, data *map[string]string, plain *map[string]string) (*Record, 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.
I don't think you need to pass pointers to maps here, since maps are already reference types:
func (c *Client) Write(ctx context.Context, recordType string, data, plain map[string]string) (*Record, error)
You can still pass nil as a map[string]string
, like you would with an error
.
client.go
Outdated
} else { | ||
plainMap = *plain | ||
} | ||
|
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.
I think this can go away if plain
becomes a map[string]string
?
version
header to Meta structure, to support safe update endpoint.Update
method to clientWrite
so it creates a record (similar to Ruby SDK). RemovedNewRecord
as it's no longer necessary.2.0.0-rc1
.