store

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: BSD-3-Clause Imports: 36 Imported by: 0

Documentation

Index

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 (s *Store) CreateFile(ctx context.Context, upload graphql.Upload) (*model.File, error)

func (*Store) CreateFileWithTimeAndUserIDAndPublicID

func (s *Store) CreateFileWithTimeAndUserIDAndPublicID(ctx context.Context, upload graphql.Upload, timestamp *time.Time, userID uuid.UUID, publicID *string) (*model.File, error)

func (*Store) CreateToken

func (s *Store) CreateToken(ctx context.Context, input model.TokenInput) (*model.CreatedToken, error)

func (*Store) DeleteFile

func (s *Store) DeleteFile(ctx context.Context, id uuid.UUID) error

func (*Store) DeleteToken

func (s *Store) DeleteToken(ctx context.Context, id uuid.UUID) error

func (*Store) DeleteUser

func (s *Store) DeleteUser(ctx context.Context, id uuid.UUID) error

func (*Store) GetFile

func (s *Store) GetFile(ctx context.Context, id uuid.UUID) (*model.File, error)

func (*Store) GetFileWithBlob

func (s *Store) GetFileWithBlob(ctx context.Context, publicID string) (*model.File, io.ReadSeeker, error)

func (*Store) GetFiles

func (s *Store) GetFiles(ctx context.Context, userID *uuid.UUID) ([]*model.File, error)

func (*Store) GetOrCreateUserBySub

func (s *Store) GetOrCreateUserBySub(ctx context.Context, sub string, nameFunc func() (*string, error)) (*model.User, error)

func (*Store) GetSelf

func (s *Store) GetSelf(ctx context.Context) (*model.User, error)

func (*Store) GetToken

func (s *Store) GetToken(ctx context.Context, id uuid.UUID) (*model.Token, error)

func (*Store) GetTokenWithUserByToken

func (s *Store) GetTokenWithUserByToken(ctx context.Context, token string) (*model.Token, error)

func (*Store) GetTokens

func (s *Store) GetTokens(ctx context.Context, userID uuid.UUID) ([]*model.Token, error)

func (*Store) GetUser

func (s *Store) GetUser(ctx context.Context, id uuid.UUID) (*model.User, error)

func (*Store) GetUsers

func (s *Store) GetUsers(ctx context.Context) ([]*model.User, error)

func (*Store) IsDBHealthy

func (s *Store) IsDBHealthy() bool

func (*Store) IsStorageHealthy added in v0.1.0

func (s *Store) IsStorageHealthy() bool

func (*Store) MigrateDownTo

func (s *Store) MigrateDownTo(version int64) error

func (*Store) MigrateUp

func (s *Store) MigrateUp() error

func (*Store) MigrateUpTo

func (s *Store) MigrateUpTo(version int64) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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