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

support delete by id #96

Merged
merged 2 commits into from
Mar 26, 2024
Merged

support delete by id #96

merged 2 commits into from
Mar 26, 2024

Conversation

kukgini
Copy link
Contributor

@kukgini kukgini commented Mar 26, 2024

Even if you do not obtain the record object, it would be convenient to be able to delete the record if you know its id.

Even if you do not obtain the record object, it would be convenient to be able to delete the record if you know its id.

Signed-off-by: kukgini <kukgini@users.noreply.github.com>
@@ -56,6 +56,10 @@ public class Repository<T: BaseRecord & Codable> {
try await wallet.session!.update(operation: .remove, category: T.type, name: record.id, value: Data(), tags: nil, expiryMs: nil)
}

public func deleteById(_ id: String, type: String) async throws {
Copy link
Contributor

Choose a reason for hiding this comment

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

Because Repository is a generic class, you don't need to give a type. Just use T.type for type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR has been improved.

as @connanoc said. there's no need to pass type as a parameter since Repository is generic class.

Signed-off-by: kukgini <kukgini@users.noreply.github.com>
@conanoc conanoc merged commit 0a32211 into hyperledger:main Mar 26, 2024
3 checks passed
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