aboutsummaryrefslogtreecommitdiff
path: root/database/posts.go
diff options
context:
space:
mode:
authorBobby <[email protected]>2025-07-16 13:18:20 +0530
committerBobby <[email protected]>2025-07-16 13:18:20 +0530
commitf13506cfba2da90764620dab2c624ac74767de62 (patch)
tree1651ed298d3f7c9dc7f6a5ccc03da7f0d133f5d6 /database/posts.go
parentf352d2678f91e4f4ea6902d084fb9590e2819e92 (diff)
downloadimageboard-f13506cfba2da90764620dab2c624ac74767de62.tar.xz
imageboard-f13506cfba2da90764620dab2c624ac74767de62.zip
constants and types refactor; next value for proper redirect on login
Diffstat (limited to 'database/posts.go')
-rw-r--r--database/posts.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/database/posts.go b/database/posts.go
new file mode 100644
index 0000000..3e949c2
--- /dev/null
+++ b/database/posts.go
@@ -0,0 +1,11 @@
+package database
+
+import "imageboard/models"
+
+func GetPosts(limit int) ([]models.Image, error) {
+ var posts []models.Image
+ if err := DB.Limit(limit).Find(&posts).Error; err != nil {
+ return nil, err
+ }
+ return posts, nil
+}