database

package
v0.0.0-...-bbf8d64 Latest Latest
Warning

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

Go to latest
Published: May 2, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package database provides functionalities to interact and set/get information to/from the database. Includes login and post functionalities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Holds the database session

var DBase Database

Global database session

func (*Database) Check

func (d *Database) Check(path string) bool

Checks if the file exists

func (*Database) Close

func (d *Database) Close()

Closes the database

func (*Database) CommentCreate

func (d *Database) CommentCreate(comment core.Comment) (int64, error)

func (*Database) CreateProfile

func (d *Database) CreateProfile(displayName string) (int64, error)

func (*Database) DelVoteComment

func (d *Database) DelVoteComment(username string, commentId int64) error

func (*Database) DelVotePost

func (d *Database) DelVotePost(username string, postId int64) error

func (*Database) DeleteProfile

func (d *Database) DeleteProfile(profileid int64) error

func (*Database) GetCommentVote

func (d *Database) GetCommentVote(username string, commentId int64) (core.UserVoteType, error)

func (*Database) GetCommentVotes

func (d *Database) GetCommentVotes(commentId int64) (int64, error)

func (*Database) GetComments

func (d *Database) GetComments(postId int64) ([]core.Comment, error)

func (*Database) GetLoginId

func (d *Database) GetLoginId(username string) (int64, error)

func (*Database) GetLoginUserFromId

func (d *Database) GetLoginUserFromId(id int64) (string, error)

func (*Database) GetNewestPosts

func (d *Database) GetNewestPosts() ([]core.Post, error)

Gets the newests posts from the database

func (*Database) GetPostAndComments

func (d *Database) GetPostAndComments(indexStr string) (core.PostComments, error)

func (*Database) GetProfile

func (d *Database) GetProfile(username string) (core.Profile, error)

func (*Database) GetProfileId

func (d *Database) GetProfileId(username string) (int64, error)

func (*Database) GetVote

func (d *Database) GetVote(username string, postId int64) (core.UserVoteType, error)

func (*Database) GetVotes

func (d *Database) GetVotes(postId int64) (int64, error)

func (*Database) Login

func (d *Database) Login(username string) (core.Login, error)

func (*Database) New

func (d *Database) New(path string) error

Create a new sqlite3 database session

func (*Database) Setup

func (d *Database) Setup() error

Setup the database

func (*Database) Signup

func (d *Database) Signup(login core.Login) error

func (*Database) SubmitPost

func (d *Database) SubmitPost(post core.Post) (int64, error)

Submit a new post into the database

func (*Database) UpdateProfile

func (d *Database) UpdateProfile(profileid int64,
	displayName string,
	info string,
	link string) error

func (*Database) VoteComment

func (d *Database) VoteComment(username string, commentId int64) error

func (*Database) VotePost

func (d *Database) VotePost(username string, postId int64) error

Jump to

Keyboard shortcuts

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