diff options
Diffstat (limited to 'sql-persistence/src/main/java/io/trygvis/persistence/sql/SqlExecutor.java')
-rw-r--r-- | sql-persistence/src/main/java/io/trygvis/persistence/sql/SqlExecutor.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sql-persistence/src/main/java/io/trygvis/persistence/sql/SqlExecutor.java b/sql-persistence/src/main/java/io/trygvis/persistence/sql/SqlExecutor.java new file mode 100644 index 0000000..ad6b8af --- /dev/null +++ b/sql-persistence/src/main/java/io/trygvis/persistence/sql/SqlExecutor.java @@ -0,0 +1,19 @@ +package io.trygvis.persistence.sql; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.List; + +public interface SqlExecutor { + int executeUpdate(UpdateCommand command); + + <T> List<T> executeQuery(QueryCommand<T> command); + + static interface UpdateCommand { + int run(Connection c) throws SQLException; + } + + static interface QueryCommand<T> { + List<T> run(Connection c) throws SQLException; + } +} |