utils

package
v0.0.0-...-a7fd21b Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// todo
	KEY = "8e71bbce7451ba2835de5aea73e4f3f96821455240823d2fd8174975b8321bfc!"
)
View Source
const PATH = "assets"

Variables

View Source
var (
	ErrFileTooLarge       = errors.New("file size exceeds maximum limit of 5MB")
	ErrFileTypeNotAllowed = errors.New("file type is not allowed")
)

Functions

func AESDecrypt

func AESDecrypt(encryptedString string) (decryptedString string, err error)

func AESEncrypt

func AESEncrypt(stringToEncrypt string) (encryptedString string, err error)

func GetExtensions

func GetExtensions(filename string) string

func RenderEmailTemplate

func RenderEmailTemplate(templatePath string, data interface{}) (string, error)

func SendMail

func SendMail(toEmail string, subject string, body string) error

func UploadFile

func UploadFile(file *multipart.FileHeader, path string) error

func UploadToImageKit

func UploadToImageKit(file multipart.File, header *multipart.FileHeader, folder string) (string, error)

UploadToImageKit uploads a file to ImageKit and returns the public URL. Requires IMAGEKIT_PRIVATE_KEY env variable to be set. SDK reads IMAGEKIT_PRIVATE_KEY from environment by default.

func ValidateImageFile

func ValidateImageFile(header *multipart.FileHeader) error

Types

type EmptyObj

type EmptyObj struct{}

type Response

type Response struct {
	Status  bool   `json:"status"`
	Message string `json:"message"`
	Error   any    `json:"error,omitempty"`
	Data    any    `json:"data,omitempty"`
	Meta    any    `json:"meta,omitempty"`
}

func BuildResponseFailed

func BuildResponseFailed(message string, err string, data any) Response

func BuildResponseSuccess

func BuildResponseSuccess(message string, data any) Response

Jump to

Keyboard shortcuts

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