database

package
v0.0.0-...-af7b3a9 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ReplicasDirStr = "./replicas"

Variables

View Source
var Connector *libsql.Connector
View Source
var DB *gorm.DB
View Source
var DBname = "dev.db"
View Source
var Replicas string

Functions

func AddPostToSection

func AddPostToSection(section *model.Section, post *model.Post) error

func CountArticles

func CountArticles() (int64, error)

func CountGalleries

func CountGalleries() (int64, error)

func CountUsers

func CountUsers() (int64, error)

func CreateArticle

func CreateArticle(article *model.Article) error

func CreateFollowList

func CreateFollowList(followList *model.FollowList) error

func CreateGallery

func CreateGallery(gallery *model.Gallery) error

func CreateImage

func CreateImage(image *model.Image) error

func CreateReport

func CreateReport(report *model.Report) error

func CreateSection

func CreateSection(section *model.Section) error

func CreateTag

func CreateTag(tag *model.Tag) error

func CreateUser

func CreateUser(user *model.User) error

func DeleteArticle

func DeleteArticle(article *model.Article) error

func DeleteGallery

func DeleteGallery(gallery *model.Gallery) error

func DeleteImage

func DeleteImage(image *model.Image) error

func DeletePostByID

func DeletePostByID(id uint64) error

func DeleteSectionByUsernameAndName

func DeleteSectionByUsernameAndName(username, name string) error

func DeleteUser

func DeleteUser(user *model.User) error

func FilterPostsInUserSection

func FilterPostsInUserSection(posts []model.Post, username, section string) ([]model.Post, error)

func FindAllArticlesByAuthorPaginated

func FindAllArticlesByAuthorPaginated(author string, page, size int) ([]model.Article, error)

func FindAllArticlesByTagPaginated

func FindAllArticlesByTagPaginated(tag string, page, size int) ([]model.Article, error)

func FindAllGalleriesByAuthorPaginated

func FindAllGalleriesByAuthorPaginated(author string, page, size int) ([]model.Gallery, error)

func FindAllGalleriesByTagPaginated

func FindAllGalleriesByTagPaginated(tag string, page, size int) ([]model.Gallery, error)

func FindAllPostsByqueryPaginated

func FindAllPostsByqueryPaginated(page, size int, query string) ([]model.Post, error)

func FindAllPostsPaginated

func FindAllPostsPaginated(page, size int) ([]model.Post, error)

func FindArticleByID

func FindArticleByID(id uint64) (model.Article, error)

func FindArticlesByQueryPaginated

func FindArticlesByQueryPaginated(query string, page, size int) ([]model.Article, error)

func FindFollowListByUsername

func FindFollowListByUsername(username string) (model.FollowList, error)

func FindFollowingPostsPaginated

func FindFollowingPostsPaginated(user model.User, page, pageSize int) ([]model.Post, error)

func FindGalleriesByQueryPaginated

func FindGalleriesByQueryPaginated(query string, page, size int) ([]model.Gallery, error)

func FindGalleryByID

func FindGalleryByID(id uint64) (model.Gallery, error)

func FindImageByID

func FindImageByID(id uint64) (model.Image, error)

func FindPaginatedPostsByTagOrderedByNumberOfVotes

func FindPaginatedPostsByTagOrderedByNumberOfVotes(tagName string, page, size int) ([]model.Post, error)

func FindPostById

func FindPostById(id uint64) (model.Post, error)

func FindPostsByQueryPaginated

func FindPostsByQueryPaginated(query string, page, size int) ([]model.Post, error)

func FindPostsByUserAndSectionPaginated

func FindPostsByUserAndSectionPaginated(username, section string, page, page_size int) ([]model.Post, error)

func FindPostsByUserNotInSectionPaginated

func FindPostsByUserNotInSectionPaginated(username, section string, page, page_size int) ([]model.Post, error)

func FindPostsByUserPaginated

func FindPostsByUserPaginated(username string, page, page_size int) ([]model.Post, error)

func FindPostsPaginated

func FindPostsPaginated(page, page_size int) ([]model.Post, error)

func FindProjectByID

func FindProjectByID(id uint64) (model.Project, error)

func FindSectionByUsernameAndName

func FindSectionByUsernameAndName(username, name string) (model.Section, error)

func FindSectionsByUser

func FindSectionsByUser(username string) ([]model.Section, error)

func FindTagByName

func FindTagByName(name string) (model.Tag, error)

func FindTagLikeName

func FindTagLikeName(name string, limit int) ([]model.Tag, error)

func FindUserByEmail

func FindUserByEmail(email string) (model.User, error)

func FindUserById

func FindUserById(id uint64) (model.User, error)

func FindUserByUsername

func FindUserByUsername(username string) (model.User, error)

func FindUsersPaginated

func FindUsersPaginated(page, pageSize int) ([]model.User, error)

func FindUsersPaginatedBySearch

func FindUsersPaginatedBySearch(search string, page, pageSize int) ([]model.User, error)

func FindVoteByTagAndUser

func FindVoteByTagAndUser(tagID uint64, username string) (model.Vote, error)

func FollowUser

func FollowUser(follower_follow_list *model.FollowList, followed *model.User) error

func GetFirstFiftyMostVotedTagsForArticle

func GetFirstFiftyMostVotedTagsForArticle(articleID uint64) ([]model.Tag, error)

func GetFirstFiftyMostVotedTagsForGallery

func GetFirstFiftyMostVotedTagsForGallery(galleryID uint64) ([]model.Tag, error)

func GetReportByID

func GetReportByID(id uint64) (model.Report, error)

func GetReportsPaginated

func GetReportsPaginated(page, pageSize int) ([]model.Report, error)

func Remigrate

func Remigrate()

func RemoveAllVotesForArticle

func RemoveAllVotesForArticle(article *model.Article) error

func RemoveAllVotesForGallery

func RemoveAllVotesForGallery(gallery *model.Gallery) error

func RemovePostFromSection

func RemovePostFromSection(section *model.Section, post *model.Post) error

func UnfollowUser

func UnfollowUser(follower_follow_list *model.FollowList, followed *model.User) error

func UnvoteTagForArticle

func UnvoteTagForArticle(article *model.Article, vote *model.Vote) error

func UnvoteTagForGallery

func UnvoteTagForGallery(gallery *model.Gallery, vote *model.Vote) error

func UpdateArticle

func UpdateArticle(article *model.Article) error

func UpdateGallery

func UpdateGallery(gallery *model.Gallery) error

func UpdateUser

func UpdateUser(user *model.User) error

func VoteExistsForTagUserAndPost

func VoteExistsForTagUserAndPost(tagID uint64, voter string, postID uint64, postType string) bool

func VoteTagForArticle

func VoteTagForArticle(article *model.Article, vote *model.Vote) error

func VoteTagForGallery

func VoteTagForGallery(gallery *model.Gallery, vote *model.Vote) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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