-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestDao.java
40 lines (30 loc) · 994 Bytes
/
TestDao.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package dev.mahabal.optigrader.api.dao;
import dev.mahabal.optigrader.api.model.Test;
import org.jdbi.v3.sqlobject.config.RegisterBeanMapper;
import org.jdbi.v3.sqlobject.customizer.Bind;
import org.jdbi.v3.sqlobject.customizer.BindFields;
import org.jdbi.v3.sqlobject.statement.SqlQuery;
import org.jdbi.v3.sqlobject.statement.SqlUpdate;
import org.jdbi.v3.stringtemplate4.UseStringTemplateSqlLocator;
import java.util.List;
import java.util.Optional;
/**
* @author Matthew
*/
@UseStringTemplateSqlLocator
public interface TestDao {
@SqlUpdate
void createTable();
@SqlUpdate
void dropTable();
@SqlUpdate
void addTest(@BindFields final Test test);
@SqlQuery
@RegisterBeanMapper(Test.class)
List<Test> getTestsOwnedByNid(@Bind("nid") final String nid);
@SqlQuery
@RegisterBeanMapper(Test.class)
Optional<Test> getTestByCode(@Bind("code") final String code);
@SqlUpdate
void deleteTestByCode(@Bind("code") final String code);
}