diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-05-02 22:38:15 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-05-02 22:38:15 -0600 |
commit | 07fd2f2f477e7fe3a21512ebc0f55bf23c8d4ceb (patch) | |
tree | 99b43838373fc35a332e3c8977bba2e3b881dd28 /app/src/main/java/com/example/wiimmterfaceandroid/database | |
parent | 1bf7224e155380ec3921cc62f36eb4f5a47d3b80 (diff) | |
download | wiimmfi-watcher-07fd2f2f477e7fe3a21512ebc0f55bf23c8d4ceb.tar wiimmfi-watcher-07fd2f2f477e7fe3a21512ebc0f55bf23c8d4ceb.tar.gz wiimmfi-watcher-07fd2f2f477e7fe3a21512ebc0f55bf23c8d4ceb.tar.bz2 |
kindof understand mvvm
Diffstat (limited to 'app/src/main/java/com/example/wiimmterfaceandroid/database')
-rw-r--r-- | app/src/main/java/com/example/wiimmterfaceandroid/database/AppDatabase.java | 11 | ||||
-rw-r--r-- | app/src/main/java/com/example/wiimmterfaceandroid/database/FriendCodeDao.java | 30 |
2 files changed, 41 insertions, 0 deletions
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/database/AppDatabase.java b/app/src/main/java/com/example/wiimmterfaceandroid/database/AppDatabase.java new file mode 100644 index 0000000..0f01149 --- /dev/null +++ b/app/src/main/java/com/example/wiimmterfaceandroid/database/AppDatabase.java @@ -0,0 +1,11 @@ +package com.example.wiimmterfaceandroid.database; + +import androidx.room.Database; +import androidx.room.RoomDatabase; + +import com.example.wiimmterfaceandroid.model.FriendCode; + +@Database(entities = {FriendCode.class}, version=1) +public abstract class AppDatabase extends RoomDatabase { + public abstract FriendCodeDao getFriendCodeDao(); +} diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/database/FriendCodeDao.java b/app/src/main/java/com/example/wiimmterfaceandroid/database/FriendCodeDao.java new file mode 100644 index 0000000..e9762fd --- /dev/null +++ b/app/src/main/java/com/example/wiimmterfaceandroid/database/FriendCodeDao.java @@ -0,0 +1,30 @@ +package com.example.wiimmterfaceandroid.database; + +import androidx.room.Dao; +import androidx.room.Delete; +import androidx.room.Insert; +import androidx.room.Query; +import androidx.room.Update; + +import com.example.wiimmterfaceandroid.model.FriendCode; + +import java.util.List; + +@Dao +public interface FriendCodeDao { + + @Query("SELECT * FROM friendcode") + public List<FriendCode> getAll(); + + @Query("SELECT * FROM friendcode") + public FriendCode findByCode(String friendCode); + + @Insert + public void insert(FriendCode friendCode); + + @Update + public void update(FriendCode friendCode); + + @Delete + public void delete(FriendCode friendCode); +} |