Documentation ¶
Index ¶
- Variables
- func ConnectDB()
- func CreateAPIKey(apiKey *models.APIKey) error
- func CreateCustomer(customer *models.Customer) error
- func CreateServer(server *models.Server) error
- func CreateUser(user *models.User) error
- func DecryptFile(data []byte, key []byte) ([]byte, error)
- func DeleteCustomer(id uint) error
- func DeleteServer(id uint) error
- func DeleteUser(id uint) error
- func DownloadFromS3(filename string) ([]byte, error)
- func EncryptFile(data []byte, key []byte) ([]byte, error)
- func GenerateDownloadLink(filename string) (string, error)
- func GetAPIKeyByAccessKey(accessKey string) (*models.APIKey, error)
- func GetAllCustomers() ([]models.Customer, error)
- func GetAllServers() ([]models.Server, error)
- func GetAllUsers() ([]models.User, error)
- func GetCustomerByID(id uint) (*models.Customer, error)
- func GetEncryptionKey() string
- func GetFilesByUserID(userID uint) ([]models.FileMetadata, error)
- func GetJWTSecret() string
- func GetServerByID(id uint) (*models.Server, error)
- func GetUploadLink(linkID string) (*models.UploadLink, error)
- func GetUserByEmail(email string) (*models.User, error)
- func GetUserByID(id uint) (*models.User, error)
- func HashSecretKey(secretKey string) (string, error)
- func InitS3() error
- func ParseInt(s string) int
- func ParseUint(s string) uint
- func SaveFileMetadata(file *models.FileMetadata) error
- func SaveUploadLink(link *models.UploadLink) error
- func SearchCustomers(query string) ([]models.Customer, error)
- func SearchServers(query string) ([]models.Server, error)
- func SearchUsers(query string) ([]models.User, error)
- func UpdateCustomer(id uint, customer *models.Customer) error
- func UpdateServer(id uint, server *models.Server) error
- func UpdateUser(id uint, user *models.User) error
- func UploadToS3(file []byte, filename string) error
- func ValidateSearchQuery(query string) error
- func VerifyAPIKey(accessKey, secretKey string) (bool, *models.User, error)
- func VerifyCredentials(email, password string) bool
- func VerifySecretKey(hashedSecretKey, secretKey string) error
Constants ¶
This section is empty.
Variables ¶
var DB *gorm.DB
DB is the database connection
Functions ¶
func CreateAPIKey ¶
CreateAPIKey creates a new API key in the database
func CreateCustomer ¶
CreateCustomer creates a new customer in the database
func CreateServer ¶
CreateServer creates a new server in the database
func CreateUser ¶
CreateUser creates a new user in the database
func DecryptFile ¶
DecryptFile decrypts a file using the given key and returns the decrypted file as a byte array
func DeleteCustomer ¶
DeleteCustomer deletes a customer from the database
func DeleteServer ¶
DeleteServer deletes a server from the database
func DownloadFromS3 ¶
DownloadFromS3 downloads a file from S3 and returns the file as a byte array
func EncryptFile ¶
EncryptFile encrypts a file using the given key and returns the encrypted file as a byte array
func GenerateDownloadLink ¶
GenerateDownloadLink generates a download link for a file in S3
func GetAPIKeyByAccessKey ¶
GetAPIKeyByAccessKey retrieves an API key from the database by its access key
func GetAllCustomers ¶
GetAllCustomers returns all customers from the database
func GetAllServers ¶
GetAllServers returns all servers from the database
func GetAllUsers ¶
GetAllUsers returns all users from the database
func GetCustomerByID ¶
GetCustomerByID retrieves a customer from the database by its ID
func GetFilesByUserID ¶
func GetFilesByUserID(userID uint) ([]models.FileMetadata, error)
GetFilesByUserID returns all files from the database by user ID
func GetServerByID ¶
GetServerByID retrieves a server from the database by its ID
func GetUploadLink ¶
func GetUploadLink(linkID string) (*models.UploadLink, error)
GetUploadLink retrieves an upload link from the database
func GetUserByEmail ¶
GetUserByEmail retrieves a user from the database by email
func GetUserByID ¶
GetUserByID gets a user by ID from the database
func HashSecretKey ¶
HashSecretKey hashes the secret key using bcrypt and returns the hashed password.
func SaveFileMetadata ¶
func SaveFileMetadata(file *models.FileMetadata) error
SaveFileMetadata saves file metadata to the database
func SaveUploadLink ¶
func SaveUploadLink(link *models.UploadLink) error
SaveUploadLink saves the upload link to the database
func SearchCustomers ¶
SearchCustomers searches for customers in the database without case sensitivity
func SearchServers ¶
SearchServers searches for servers in the database without case sensitivity
func SearchUsers ¶
SearchUsers searches for users in the database
func UpdateCustomer ¶
UpdateCustomer updates a customer in the database
func UpdateServer ¶
UpdateServer updates a server in the database
func UpdateUser ¶
UpdateUser updates a user in the database
func UploadToS3 ¶
UploadToS3 uploads a file to S3
func ValidateSearchQuery ¶
ValidateSearchQuery validates the search query based on DNS rules
func VerifyAPIKey ¶
VerifyAPIKey verifies the provided API accessKey and secretKey
func VerifyCredentials ¶
VerifyCredentials checks if the email and password are valid and returns true if they are valid, otherwise it returns false
func VerifySecretKey ¶
VerifySecretKey verifies if the provided secret key matches the hashed password.
Types ¶
This section is empty.
Source Files ¶
- ConnectDB.go
- CreateAPIKey.go
- CreateCustomer.go
- CreateServer.go
- CreateUser.go
- DecryptFile.go
- DeleteCustomer.go
- DeleteServer.go
- DeleteUser.go
- DownloadFromS3.go
- EncryptFile.go
- GenerateDownloadLink.go
- GetAPIKeyByAccessKey.go
- GetAllCustomers.go
- GetAllServers.go
- GetAllUsers.go
- GetCustomerByID.go
- GetEncryptionKey.go
- GetFilesByUserID.go
- GetJWTSecret.go
- GetServerByID.go
- GetUploadLink.go
- GetUserByEmail.go
- GetUserByID.go
- InitS3.go
- ParseInt.go
- ParseUint.go
- SaveFileMetadata.go
- SaveUploadLink.go
- SearchCustomers.go
- SearchServers.go
- SearchUsers.go
- SecretKey.go
- UpdateCustomer.go
- UpdateServer.go
- UpdateUser.go
- UploadToS3.go
- ValidateSearchQuery.go
- VerifyAPIKey.go
- VerifyCredentials.go
- generateRandomString.go
- utils.go