Skip to content

Commit

Permalink
Optimize SQL user loading and saving (#303)
Browse files Browse the repository at this point in the history
- A user is now loaded in a single statement with subqueries
- Saving key_values will now utilize batched statements
  • Loading branch information
Archy-X authored Jul 10, 2024
1 parent a600232 commit ab86bd2
Show file tree
Hide file tree
Showing 4 changed files with 361 additions and 280 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
import java.util.Locale;
import java.util.Map;

public record EntityProperties(String entityId,
String name,
Integer level,
Double health,
Double damage,
Float horizontalVelocity,
Float verticalVelocity,
Map<EquipmentSlot, ItemStack> equipment) {
public record EntityProperties(
String entityId,
String name,
Integer level,
Double health,
Double damage,
Float horizontalVelocity,
Float verticalVelocity,
Map<EquipmentSlot, ItemStack> equipment
) {

public static EntityProperties fromConfig(ConfigurationNode config, AuraSkills plugin) {
String[] id = config.node("entity").getString("").split(":");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package dev.aurelium.auraskills.common.storage.sql;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public record KeyValueRow(
int dataId,
@Nullable String categoryId,
@NotNull String keyName,
@NotNull String value
) {
}
Loading

0 comments on commit ab86bd2

Please sign in to comment.