database

package
v0.0.0-...-8690547 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func CreateBoard

func CreateBoard(shortname, name, description string) (*models.Board, error)

CreateBoard creates a new board

func CreateReply

func CreateReply(boardID uint, threadID uint, content, author string, fileData []byte, fileName, fileType string) (*models.Post, error)

CreateReply creates a reply to a thread

func CreateThread

func CreateThread(boardID uint, title, content, author string, fileData []byte, fileName, fileType string) (*models.Post, error)

CreateThread creates a new thread in the database

func GetAllBoards

func GetAllBoards() ([]models.Board, error)

GetAllBoards gets all boards from the database

func GetAllThreads

func GetAllThreads() ([]models.Post, error)

GetAllThreads gets all threads from the database

func GetBoardByID

func GetBoardByID(id uint) (models.Board, error)

GetBoardByID gets a board by its ID

func GetBoardByShortname

func GetBoardByShortname(shortname string) (models.Board, error)

GetBoardByShortname gets a board by its shortname

func GetBoardThreads

func GetBoardThreads(boardID uint) ([]models.Post, error)

GetBoardThreads gets all threads for a specific board

func GetDB

func GetDB() *gorm.DB

GetDB returns the database connection

func GetFileByPostID

func GetFileByPostID(postID uint) (models.Post, error)

GetFileByPostID gets a file by post ID

func GetThreadWithReplies

func GetThreadWithReplies(threadID uint) (models.Post, []models.Post, error)

GetThreadWithReplies gets a thread and all its replies

func GetThumbnailByPostID

func GetThumbnailByPostID(postID uint) (models.Post, error)

GetThumbnailByPostID gets a thumbnail by post ID

func Initialize

func Initialize()

Initialize sets up the database connection and migrations

func SeedSampleData

func SeedSampleData() error

SeedSampleData adds some initial sample data if the database is empty

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL