Documentation ¶
Index ¶
- Constants
- type LocalStorageProvider
- func (l *LocalStorageProvider) CreateFile(ctx context.Context, hash string, rs io.ReadSeeker, size int64, ...) error
- func (l *LocalStorageProvider) DeleteFile(ctx context.Context, hash string) error
- func (l *LocalStorageProvider) GetFile(ctx context.Context, hash string) (io.ReadSeeker, error)
- func (l *LocalStorageProvider) IsHealthy() bool
- type S3StorageProvider
- func (s *S3StorageProvider) CreateFile(ctx context.Context, hash string, rs io.ReadSeeker, size int64, ...) error
- func (s *S3StorageProvider) DeleteFile(ctx context.Context, hash string) error
- func (s *S3StorageProvider) GetFile(ctx context.Context, hash string) (io.ReadSeeker, error)
- func (s *S3StorageProvider) IsHealthy() bool
- type StorageProvider
- type Store
- func (s *Store) CreateFile(ctx context.Context, upload graphql.Upload) (*model.File, error)
- func (s *Store) CreateFileWithTimeAndUserIDAndPublicID(ctx context.Context, upload graphql.Upload, timestamp *time.Time, ...) (*model.File, error)
- func (s *Store) CreateToken(ctx context.Context, input model.TokenInput) (*model.CreatedToken, error)
- func (s *Store) DeleteFile(ctx context.Context, id uuid.UUID) error
- func (s *Store) DeleteToken(ctx context.Context, id uuid.UUID) error
- func (s *Store) DeleteUser(ctx context.Context, id uuid.UUID) error
- func (s *Store) GetFile(ctx context.Context, id uuid.UUID) (*model.File, error)
- func (s *Store) GetFileWithBlob(ctx context.Context, publicID string) (*model.File, io.ReadSeeker, error)
- func (s *Store) GetFiles(ctx context.Context, userID *uuid.UUID) ([]*model.File, error)
- func (s *Store) GetOrCreateUserBySub(ctx context.Context, sub string, nameFunc func() (*string, error)) (*model.User, error)
- func (s *Store) GetSelf(ctx context.Context) (*model.User, error)
- func (s *Store) GetToken(ctx context.Context, id uuid.UUID) (*model.Token, error)
- func (s *Store) GetTokenWithUserByToken(ctx context.Context, token string) (*model.Token, error)
- func (s *Store) GetTokens(ctx context.Context, userID uuid.UUID) ([]*model.Token, error)
- func (s *Store) GetUser(ctx context.Context, id uuid.UUID) (*model.User, error)
- func (s *Store) GetUsers(ctx context.Context) ([]*model.User, error)
- func (s *Store) IsDBHealthy() bool
- func (s *Store) IsStorageHealthy() bool
- func (s *Store) MigrateDownTo(version int64) error
- func (s *Store) MigrateUp() error
- func (s *Store) MigrateUpTo(version int64) error
Constants ¶
View Source
const MigrateLatestVersion int64 = -1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalStorageProvider ¶ added in v0.1.0
type LocalStorageProvider struct {
// contains filtered or unexported fields
}
func NewLocalStorageProvider ¶ added in v0.1.0
func NewLocalStorageProvider(localConfig config.StorageLocalConfig) (*LocalStorageProvider, error)
func (*LocalStorageProvider) CreateFile ¶ added in v0.1.0
func (l *LocalStorageProvider) CreateFile(ctx context.Context, hash string, rs io.ReadSeeker, size int64, contentType string) error
func (*LocalStorageProvider) DeleteFile ¶ added in v0.1.0
func (l *LocalStorageProvider) DeleteFile(ctx context.Context, hash string) error
func (*LocalStorageProvider) GetFile ¶ added in v0.1.0
func (l *LocalStorageProvider) GetFile(ctx context.Context, hash string) (io.ReadSeeker, error)
func (*LocalStorageProvider) IsHealthy ¶ added in v0.1.0
func (l *LocalStorageProvider) IsHealthy() bool
type S3StorageProvider ¶ added in v0.1.0
type S3StorageProvider struct {
// contains filtered or unexported fields
}
func NewS3StorageProvider ¶ added in v0.1.0
func NewS3StorageProvider(s3Config config.StorageS3Config) (*S3StorageProvider, error)
func (*S3StorageProvider) CreateFile ¶ added in v0.1.0
func (s *S3StorageProvider) CreateFile(ctx context.Context, hash string, rs io.ReadSeeker, size int64, contentType string) error
func (*S3StorageProvider) DeleteFile ¶ added in v0.1.0
func (s *S3StorageProvider) DeleteFile(ctx context.Context, hash string) error
func (*S3StorageProvider) GetFile ¶ added in v0.1.0
func (s *S3StorageProvider) GetFile(ctx context.Context, hash string) (io.ReadSeeker, error)
func (*S3StorageProvider) IsHealthy ¶ added in v0.1.0
func (s *S3StorageProvider) IsHealthy() bool
type StorageProvider ¶ added in v0.1.0
type StorageProvider interface { // CreateFile atomically creates the file // If the file already exists, the error will be nil CreateFile(ctx context.Context, hash string, rs io.ReadSeeker, size int64, contentType string) error // GetFile returns a file handle GetFile(ctx context.Context, hash string) (io.ReadSeeker, error) // DeleteFile deletes the file DeleteFile(ctx context.Context, hash string) error // IsHealthy checks if the storage is healthy IsHealthy() bool }
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewStore ¶
func NewStore(dbConfig config.DatabaseConfig, storageConfig config.StorageConfig) (*Store, error)
func (*Store) CreateFile ¶
func (*Store) CreateFileWithTimeAndUserIDAndPublicID ¶
func (*Store) CreateToken ¶
func (s *Store) CreateToken(ctx context.Context, input model.TokenInput) (*model.CreatedToken, error)
func (*Store) GetFileWithBlob ¶
func (*Store) GetOrCreateUserBySub ¶
func (*Store) GetTokenWithUserByToken ¶
func (*Store) IsDBHealthy ¶
func (*Store) IsStorageHealthy ¶ added in v0.1.0
func (*Store) MigrateDownTo ¶
func (*Store) MigrateUpTo ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.