database

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close the database connection

func ColumnExists added in v1.8.0

func ColumnExists(tableName, columnName string) (bool, error)

ColumnExists returns true if a column with the name columnName exists in table tableName Should only be used for upgrading

func DeleteAllSessions

func DeleteAllSessions()

DeleteAllSessions logs all users out

func DeleteApiKey

func DeleteApiKey(id string)

DeleteApiKey deletes an API key with the given ID

func DeleteEnd2EndInfo added in v1.6.0

func DeleteEnd2EndInfo()

DeleteEnd2EndInfo resets the encrypted e2e info

func DeleteHotlink(id string)

DeleteHotlink deletes a hotlink with the given hotlink ID

func DeleteMetaData

func DeleteMetaData(id string)

DeleteMetaData deletes information about a file

func DeleteSession

func DeleteSession(id string)

DeleteSession deletes a session with the given ID

func GetAllApiKeys

func GetAllApiKeys() map[string]models.ApiKey

GetAllApiKeys returns a map with all API keys

func GetAllHotlinks() []string

GetAllHotlinks returns an array with all hotlink ids

func GetAllMetaDataIds added in v1.6.0

func GetAllMetaDataIds() []string

GetAllMetaDataIds returns all Ids that contain metadata

func GetAllMetadata

func GetAllMetadata() map[string]models.File

GetAllMetadata returns a map of all available files

func GetApiKey

func GetApiKey(id string) (models.ApiKey, bool)

GetApiKey returns a models.ApiKey if valid or false if the ID is not valid

func GetEnd2EndInfo added in v1.6.0

func GetEnd2EndInfo() models.E2EInfoEncrypted

GetEnd2EndInfo retrieves the encrypted e2e info

func GetHotlink(id string) (string, bool)

GetHotlink returns the id of the file associated or false if not found

func GetMetaDataById

func GetMetaDataById(id string) (models.File, bool)

GetMetaDataById returns a models.File from the ID passed or false if the id is not valid

func GetSession

func GetSession(id string) (models.Session, bool)

GetSession returns the session with the given ID or false if not a valid ID

func GetUploadDefaults

func GetUploadDefaults() models.LastUploadValues

GetUploadDefaults returns the last used setting for amount of downloads allowed, last expiry in days and a password for the file

func GetUploadStatus added in v1.7.0

func GetUploadStatus(id string) (models.UploadStatus, bool)

GetUploadStatus returns a models.UploadStatus from the ID passed or false if the id is not valid

func Init

func Init(dataDir, dbName string)

Init creates the database files and connects to it

func RawSqlite added in v1.8.0

func RawSqlite(statement string) error

RawSqlite runs a raw SQL statement. Should only be used for upgrading

func RunGarbageCollection

func RunGarbageCollection()

RunGarbageCollection runs the databases GC

func SaveApiKey

func SaveApiKey(apikey models.ApiKey)

SaveApiKey saves the API key to the database

func SaveEnd2EndInfo added in v1.6.0

func SaveEnd2EndInfo(info models.E2EInfoEncrypted)

SaveEnd2EndInfo stores the encrypted e2e info

func SaveHotlink(file models.File)

SaveHotlink stores the hotlink associated with the file in the database

func SaveMetaData

func SaveMetaData(file models.File)

SaveMetaData stores the metadata of a file to the disk

func SaveSession

func SaveSession(id string, session models.Session)

SaveSession stores the given session. After the expiry passed, it will be deleted automatically

func SaveUploadDefaults

func SaveUploadDefaults(values models.LastUploadValues)

SaveUploadDefaults saves the last used setting for an upload

func SaveUploadStatus added in v1.7.0

func SaveUploadStatus(status models.UploadStatus)

SaveUploadStatus stores the upload status of a new file for 24 hours

func UpdateTimeApiKey added in v1.8.0

func UpdateTimeApiKey(apikey models.ApiKey)

UpdateTimeApiKey writes the content of LastUsage to the database

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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