From a0058eae63532012f6e6c24323d15bca23f98d28 Mon Sep 17 00:00:00 2001 From: Miguel de la Cruz Date: Mon, 13 Sep 2021 23:46:35 +0200 Subject: [PATCH] Add post model and store --- server/services/store/post.go | 15 +++++++++++++++ server/services/store/store.go | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 server/services/store/post.go diff --git a/server/services/store/post.go b/server/services/store/post.go new file mode 100644 index 0000000..31d7754 --- /dev/null +++ b/server/services/store/post.go @@ -0,0 +1,15 @@ +package store + +import ( + "database/sql" +) + +var postColums = []string{"id", "user_id", "game_id", "createdat", "body"} + +type PostStore struct { + Conn *sql.DB +} + +func NewPostStore(s *Store) *PostStore { + return &PostStore{Conn: s.Conn} +} diff --git a/server/services/store/store.go b/server/services/store/store.go index 0576e33..1ad11ca 100644 --- a/server/services/store/store.go +++ b/server/services/store/store.go @@ -14,6 +14,7 @@ type Store struct { userStore *UserStore gameStore *GameStore + postStore *PostStore } func addPathOptions(path string) string { @@ -40,6 +41,7 @@ func NewStore(path string) (*Store, error) { // init stores s.userStore = NewUserStore(s) s.gameStore = NewGameStore(s) + s.postStore = NewPostStore(s) return s, nil }