database

package
v0.0.0-...-db146dd Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cache = cache.New(5*time.Minute, 10*time.Minute)
View Source
var Connection *sql.DB

Functions

func CreateBucket

func CreateBucket(bucket StorageBucket) error

func CreateObject

func CreateObject(object StorageObject) error

func DeleteApiKey

func DeleteApiKey(apiKey string) error

func Init

func Init() *sql.DB

func Migrate

func Migrate()

Types

type ApiKey

type ApiKey struct {
	Id        int
	ApiKey    string
	CreatedAt string
}

func GenerateApiKey

func GenerateApiKey() (ApiKey, error)

func GetApiKey

func GetApiKey(apiKey string) (ApiKey, error)

func GetApiKeys

func GetApiKeys() ([]ApiKey, error)

type StorageBucket

type StorageBucket struct {
	Id        int
	Name      string
	Type      string
	MaxSize   int64
	RootPath  string
	Ip        string
	Port      int
	Username  string
	Password  string
	CreatedAt string
}

func GetAllBuckets

func GetAllBuckets() ([]StorageBucket, error)

func GetAvailableBucket

func GetAvailableBucket(filesize int) (StorageBucket, error)

func GetBucketById

func GetBucketById(id int) (StorageBucket, error)

func GetBucketByName

func GetBucketByName(name string) (StorageBucket, error)

type StorageObject

type StorageObject struct {
	Id         int
	Bucket     StorageBucket // This should be mapped to the StorageBucket struct, not just the bucket_id.
	Slug       string
	Size       int
	FileType   string
	FilePath   string
	UploadedBy string
	CreatedAt  string
}

func FindObjectBySlug

func FindObjectBySlug(slug string) (StorageObject, error)

Jump to

Keyboard shortcuts

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