Documentation ¶
Index ¶
- Constants
- type DatabaseConnection
- func (dbConn *DatabaseConnection) AddPost(post Post) error
- func (dbConn DatabaseConnection) CheckIfUserExists(username string) bool
- func (dbConn DatabaseConnection) CreateUser(username, password string)
- func (dbConn *DatabaseConnection) GetAllPosts() Posts
- func (dbConn DatabaseConnection) GetIdFromUsername(username string) int64
- func (dbConn DatabaseConnection) GetPasswordById(id int64) (string, error)
- func (dbConn DatabaseConnection) GetPasswordByUsername(username string) (string, error)
- func (dbConn DatabaseConnection) GetUsername(id int64) (string, error)
- func (dbConn DatabaseConnection) VerifyPasswordByUsername(username, password string) bool
- type Post
- type Posts
- type User
Constants ¶
View Source
const ( GET_ALL_POSTS = "" /* 142-byte string literal not displayed */ ADD_POST = "INSERT INTO posts VALUES(DEFAULT, $1, $2, $3, $4);" )
View Source
const DATABASE_SETTINGS_FILE = "database_settings.json"
DATABASE_SETTINGS_FILE is the file that will be read to make a postgres url
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseConnection ¶
type DatabaseConnection struct { Username string `json:"username"` Password string `json:"password"` Port string `json:"port"` DatabaseName string `json:"databaseName"` // contains filtered or unexported fields }
DatabaseConnection holds all the important data for the postgres connection
func CreateDatabaseConnection ¶
func CreateDatabaseConnection() DatabaseConnection
Creates the DatabaseConnection object
func (*DatabaseConnection) AddPost ¶
func (dbConn *DatabaseConnection) AddPost(post Post) error
func (DatabaseConnection) CheckIfUserExists ¶
func (dbConn DatabaseConnection) CheckIfUserExists(username string) bool
checks if a user exists
func (DatabaseConnection) CreateUser ¶
func (dbConn DatabaseConnection) CreateUser(username, password string)
checks if a user exists
func (*DatabaseConnection) GetAllPosts ¶
func (dbConn *DatabaseConnection) GetAllPosts() Posts
func (DatabaseConnection) GetIdFromUsername ¶
func (dbConn DatabaseConnection) GetIdFromUsername(username string) int64
GetUsername gets the users password from the id
func (DatabaseConnection) GetPasswordById ¶
func (dbConn DatabaseConnection) GetPasswordById(id int64) (string, error)
GetUsername gets the users password from the id
func (DatabaseConnection) GetPasswordByUsername ¶
func (dbConn DatabaseConnection) GetPasswordByUsername(username string) (string, error)
GetUsername gets the users password from the id
func (DatabaseConnection) GetUsername ¶
func (dbConn DatabaseConnection) GetUsername(id int64) (string, error)
GetUsername gets the users username from the id
func (DatabaseConnection) VerifyPasswordByUsername ¶
func (dbConn DatabaseConnection) VerifyPasswordByUsername(username, password string) bool
Verifys the password of a user
Click to show internal directories.
Click to hide internal directories.