utils

package
v0.0.0-...-985400f Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const TTL = 2

expressed in hours

Variables

This section is empty.

Functions

func CleanupTmpFiles

func CleanupTmpFiles()

cleanup files from the tmp directory after a given time

func GenerateQR

func GenerateQR(id string) (string, error)

func NewGridFsBucket

func NewGridFsBucket(client *mongo.Client) *gridfs.Bucket

func NewMongoClient

func NewMongoClient(uri string) *mongo.Client

func RemoveFile

func RemoveFile(filePath string)

Types

type Configuration

type Configuration struct {
	APP_URL string
	DB_URL  string
	MODE    string
	PORT    string
	TMP_EXP int
}

func GetConfig

func GetConfig() *Configuration

type Datastore

type Datastore struct {
	DB        *mongo.Client
	FileStore *gridfs.Bucket
}

func NewDatastore

func NewDatastore() *Datastore

type File

type File struct {
	Id         primitive.ObjectID `json:"_id"`
	ChunkSize  int                `json:"chunkSize"`
	Filename   string             `json:"filename"`
	Length     int                `json:"length"`
	Metadata   FileMetadata       `json:"metadata"`
	UploadDate primitive.DateTime `json:"uploadDate"`
}

type FileMetadata

type FileMetadata struct {
	Extension string             `json:"extension"`
	LastRead  primitive.DateTime `json:"lastRead"`
	Type      string             `json:"type"`
}

type HttpResponse

type HttpResponse struct {
	Success bool        `json:"success"`
	Message string      `json:"message,omitempty"`
	Data    interface{} `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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