psql

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

database

Functions

func AddUploadedFileInfo

func AddUploadedFileInfo(filename, username, fileKey string) error

add a upload info

func AddUser

func AddUser(username, hashed_password string) error

TODO: add user to users table

func CloseDB

func CloseDB()

close database connection

func InitDB

func InitDB(connectionStr string) error

initialize database connection

func UpdateUploadEnableByFileId

func UpdateUploadEnableByFileId(file_id uint, enable bool) error

get user data by username from users table

Types

type Upload

type Upload struct {
	ID        int
	Filename  string
	Username  string
	CreatedAt string
	Enable    bool
	FileKey   string
}

uploads table data

func GetUploadByFileId

func GetUploadByFileId(file_id uint) (*Upload, error)

get user data by username from users table

func GetUploadsByUsername

func GetUploadsByUsername(username string) ([]Upload, error)

TODO: Paginate data TODO: Config limit rate retrieve data on uploads table

type User

type User struct {
	ID             int
	Username       string
	HashedPassword string
	CreatedAt      string
}

users table data

func GetUserByUsername

func GetUserByUsername(username string) (*User, error)

get user data by username from users table

Jump to

Keyboard shortcuts

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