db

package
v0.0.0-...-9ce60a6 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddURL

func AddURL(owner int, src string, dst string, isCustom bool) error

func ChangePassword

func ChangePassword(id_user int, password string) error

func Close

func Close()

func Connect

func Connect() *sql.DB

func CreateUser

func CreateUser(username string, password string) error

func DeleteURL

func DeleteURL(id_link int) error

func GetCurrentUsername

func GetCurrentUsername(r *http.Request) (string, error)

Get the username from the session ID

func GetKeyFromRequest

func GetKeyFromRequest(r *http.Request) (string, error)

func GetURLRedirect

func GetURLRedirect(src string) (string, error)

func GetUserDetails

func GetUserDetails(username string) (int, string, string, error)

func GetUserIDFromSessionID

func GetUserIDFromSessionID(sessionid string) (int, error)

Get the user ID from the session ID

func HashPassword

func HashPassword(password, salt string) string

func InvalidateAllSessionIDs

func InvalidateAllSessionIDs(id_user int) error

func InvalidateSessionID

func InvalidateSessionID(sessionid string) error

func IsAPIKeyValid

func IsAPIKeyValid(sessionid string) bool

The session ID exists, is valid, and is an API key

func IsSessionIDValid

func IsSessionIDValid(sessionid string) bool

The session ID exists, is valid, and is not an API key

func NewSessionID

func NewSessionID(id_user int, valid_until int, api bool) (string, error)

func RandString

func RandString(n int) string

func UpdateURL

func UpdateURL(id_link int, src string, dst string, isCustom bool) error

func ValidatePassword

func ValidatePassword(password, salt, hashedPwd string) bool

Validate the user's credentials

Types

type URL

type URL struct {
	IDLink   int
	Owner    int
	Src      string
	Dst      string
	IsCustom bool
}

func GetURLDetails

func GetURLDetails(id_link int) (URL, error)

func GetUserURLs

func GetUserURLs(username string) ([]URL, error)

Jump to

Keyboard shortcuts

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