Documentation
¶
Index ¶
Constants ¶
const Tables string = `` /* 1512-byte string literal not displayed */
Groups table contains data for group so it can be joined when called by the user files table contains all the metadata of the file and how many parts it may have, that total_parts is calculated by a function and doesn't care about the discord files. Parts table has all the parts that are uploaded by the UploadFiles function On the groups table, root group means if a group is related to some other group, TODO: add better names
Variables ¶
var (
DB *sql.DB
)
Functions ¶
func GetPartIDs ¶
gets all the fileparts for use by different function, it returns them in orders since discord uses a timestamp as id it works fine
func InitDatabase ¶
func InitDatabase() error
InitDatabase initializes the database, creating necessary tables if they don't exist.
func RegisterFileEntry ¶
func RegisterFileEntry(ctx context.Context, fileStructure *FilesLocal) (int64, error)
RegisterFileEntry adds a file entry to the files table in the database.
Types ¶
type FilesDB ¶
type FilesDB struct { ID int // Auto-incremented ID, PRIMARY KEY FilesLocal }
FilesDB represents a file entry in the database, including its ID.
type FilesLocal ¶
type FilesLocal struct { Name string // Name of the file Total_parts int // Number of parts the file is divided into Size int64 // Size of the file Hash string // Hash for verifying file integrity, on complete download user may check for hash match GroupID int // User may assign group to each file for future search commands, multiple files may belong to same group i.e. math books }
FilesLocal represents a local file's metadata.