Documentation
¶
Overview ¶
implementation of the DB logic
defines the models stored in the DB
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoStorage = errors.New("no storage set on event")
Functions ¶
Types ¶
type DB ¶
type DB interface { CreateEvent(context.Context, *Event) (uint, error) GetEvents(context.Context, uint) ([]*Event, error) GetEvent(context.Context, uint64) (*Event, error) GetEventBySlug(context.Context, string) (*Event, error) GetActiveEvent(context.Context) (*Event, error) SetActiveEvent(context.Context, uint64) error AddFileInfo(context.Context, *FileInfo) error GetFileInfo(context.Context, string) (*FileInfo, error) AddThumbnailInfo(context.Context, *ThumbnailInfo) error GetThumbnails(ctx context.Context, eventId uint, limit int, offset int) ([]*ThumbnailInfo, error) GetThumbnailInfo(context.Context, string) (*ThumbnailInfo, error) SetEventLive(context.Context, uint64, bool) (*Event, error) DeleteEvent(context.Context, uint64) error CreateUser(context.Context, string, string) error GetUser(context.Context, string) (*User, error) UserAuthorizedForEvent(context.Context, uint, uint) (bool, error) StoreGoogleToken(ctx context.Context, userId uint, token []byte) error GetGoogleToken(ctx context.Context, uideId uint) ([]byte, error) DeleteGoogleToken(ctx context.Context, userId uint) error }
type Event ¶
type Event struct { gorm.Model Name string Slug string `gorm:"uniqueIndex"` Live bool // whether or not to cache media stored in the event Cache bool FileInfos []FileInfo ThumbnailInfos []ThumbnailInfo UserID uint User User Active bool Password *gormcrypto.EncryptedValue storage.Storage `gorm:"-"` // All available storage options for the event // Only one should be set, the rest must be null FileSystemStorage *FileSystemStorage S3Storage *S3Storage GoogleDriveStorage *GoogleDriveStorage FtpStorage *FtpStorage }
type FtpStorage ¶
type FtpStorage struct { gorm.Model Address string Directory string Username gormcrypto.EncryptedValue Password gormcrypto.EncryptedValue EventID uint }
type GoogleDriveStorage ¶
type GoogleDriveToken ¶
type GoogleDriveToken struct { gorm.Model Token gormcrypto.EncryptedValue UserID uint }
type S3Storage ¶
type S3Storage struct { gorm.Model Region string AccessKey gormcrypto.EncryptedValue SecretKey gormcrypto.EncryptedValue Bucket string Endpoint string EventID uint Insecure bool }
type ThumbnailInfo ¶
Click to show internal directories.
Click to hide internal directories.