Skip to content

Commit

Permalink
docs: create searchByid documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <[email protected]>
  • Loading branch information
otaviojava committed Nov 29, 2023
1 parent f0cd285 commit 46df77f
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion core/src/main/java/expert/os/harperdb/SearchById.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;
import java.util.Set;

final class SearchById extends Operation{
/**
* Represents the "search by ID" operation in HarperDB.
* This operation is used to retrieve records from a specific table in a given database based on their IDs.
*/
final class SearchById extends Operation {


@JsonProperty
Expand All @@ -19,11 +24,48 @@ final class SearchById extends Operation{
@JsonProperty("get_attributes")
private final Set<String> attributes;

/**
* Constructs a new SearchById operation with the specified database, table, IDs, and attributes.
*
* @param database The name of the database where records will be searched.
* @param table The name of the table where records will be searched.
* @param ids The set of IDs used to identify and retrieve specific records.
* @param attributes The set of attributes to retrieve for each record.
*/
SearchById(String database, String table, Set<Object> ids, Set<String> attributes) {
super(OperationType.SEARCH_BY_ID);
this.database = database;
this.table = table;
this.ids = ids;
this.attributes = attributes;
}


@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object == null || getClass() != object.getClass()) {
return false;
}
SearchById that = (SearchById) object;
return Objects.equals(database, that.database) && Objects.equals(table, that.table)
&& Objects.equals(ids, that.ids) && Objects.equals(attributes, that.attributes);
}

@Override
public int hashCode() {
return Objects.hash(database, table, ids, attributes);
}

@Override
public String toString() {
return "SearchById{" +
"database='" + database + '\'' +
", table='" + table + '\'' +
", ids=" + ids +
", attributes=" + attributes +
'}';
}
}

0 comments on commit 46df77f

Please sign in to comment.