Documentation
¶
Overview ¶
Package db manages the database of the app
Index ¶
- func ChangePasswordOfPath(ctx context.Context, db *DB, path string, password string) error
- func CheckIfPathHasAuth(ctx context.Context, db *DB, path string) (bool, error)
- func CreateAuthForPath(ctx context.Context, db *DB, path string, password string) error
- func GetPasswordOfPath(ctx context.Context, db *DB, path string) (string, error)
- func RemovePasswordOfPath(ctx context.Context, db *DB, path string) error
- func RemoveUploadSessionByPath(ctx context.Context, db *DB, path string, filename string) error
- func RemoveUploadSessionByToken(ctx context.Context, db *DB, tokenString string) error
- func RenameAuthPath(ctx context.Context, db *DB, oldPath string, newPath string) error
- func SaveUploadSession(ctx context.Context, db *DB, session map[string]any) error
- type DB
- type ItemPassword
- type UploadSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangePasswordOfPath ¶
func CheckIfPathHasAuth ¶
CheckIfPathHasAuth checks if a given path requires authentication to access.
func CreateAuthForPath ¶
CreateAuthForPath inserts a new path with the given password into the database.
func GetPasswordOfPath ¶
GetPasswordOfPath retrieves the password for a given path from the database.
func RemovePasswordOfPath ¶
func RemoveUploadSessionByPath ¶
RemoveUploadSessionByPath removes all upload sessions by their path and filename from the database.
func RemoveUploadSessionByToken ¶
RemoveUploadSessionByToken removes an upload session by its token from the database.
func RenameAuthPath ¶
Types ¶
type DB ¶
type ItemPassword ¶
type UploadSession ¶
type UploadSession struct {
Token string `db:"token"`
Path string `db:"path"`
Filename string `db:"filename"`
CreatedAt int64 `db:"created_at"`
}
func GetUploadSession ¶
func GetUploadSession(ctx context.Context, db *DB, tokenString string) (result *UploadSession, err error)
GetUploadSession retrieves an upload session by its token from the database. If no session is found, it returns nil and nil.
Click to show internal directories.
Click to hide internal directories.