Skip to content

Commit

Permalink
Change function names from put to insert
Browse files Browse the repository at this point in the history
  • Loading branch information
KodaiD committed Nov 12, 2024
1 parent 17c6dfa commit 789b3c2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void loadCustomerIfNotExists(
throws CrudException {
Optional<Customer> customer = Customer.get(transaction, id);
if (!customer.isPresent()) {
Customer.put(transaction, id, name, creditLimit, creditTotal);
Customer.insert(transaction, id, name, creditLimit, creditTotal);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Customer(int id, String name, int creditLimit, int creditTotal) {
this.creditTotal = creditTotal;
}

public static void put(
public static void insert(
TransactionCrudOperable transaction, int id, String name, int creditLimit, int creditTotal)
throws CrudException {
transaction.insert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void loadItemIfNotExists(
DistributedTransaction transaction, int id, String name, int price) throws CrudException {
Optional<Item> item = Item.get(transaction, id);
if (!item.isPresent()) {
Item.put(transaction, id, name, price);
Item.insert(transaction, id, name, price);
}
}

Expand All @@ -106,13 +106,13 @@ public void placeOrder(
transaction -> {
String orderId = UUID.randomUUID().toString();

// Put the order info into the orders table
Order.put(transaction, orderId, request.getCustomerId(), System.currentTimeMillis());
// Insert the order info into the orders table
Order.insert(transaction, orderId, request.getCustomerId(), System.currentTimeMillis());

int amount = 0;
for (ItemOrder itemOrder : request.getItemOrderList()) {
// Put the order statement into the statements table
Statement.put(transaction, orderId, itemOrder.getItemId(), itemOrder.getCount());
// Insert the order statement into the statements table
Statement.insert(transaction, orderId, itemOrder.getItemId(), itemOrder.getCount());

// Retrieve the item info from the items table
Optional<Item> item = Item.get(transaction, itemOrder.getItemId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Item(int id, String name, int price) {
this.price = price;
}

public static void put(TransactionCrudOperable transaction, int id, String name, int price)
public static void insert(TransactionCrudOperable transaction, int id, String name, int price)
throws CrudException {
transaction.insert(
Insert.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Order(String id, int customerId, long timestamp) {
this.timestamp = timestamp;
}

public static void put(
public static void insert(
TransactionCrudOperable transaction, String id, int customerId, long timestamp)
throws CrudException {
transaction.insert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public Statement(String orderId, int itemId, int count) {
this.count = count;
}

public static void put(TransactionCrudOperable transaction, String orderId, int itemId, int count)
public static void insert(TransactionCrudOperable transaction, String orderId, int itemId, int count)
throws CrudException {
transaction.insert(
Insert.newBuilder()
Expand Down

0 comments on commit 789b3c2

Please sign in to comment.