Documentation ¶
Index ¶
- func CreateMetadataIndex(ctx context.Context, coll *mongo.Collection) error
- func MakeSymlinkQuery(expiration, id string) string
- func MakeSymlinkSignature(expiration, id, name string) string
- func NewMongoClient(ctx context.Context, uri string) (*mongo.Client, error)
- func NewS3Session(region, s3_endpoint, accessKey, secretKey string) (*session.Session, error)
- type FileDownloader
- type FileUploader
- type Metadata
- type MetadataClient
- type MockMetadataClient
- type Symlink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMetadataIndex ¶
func CreateMetadataIndex(ctx context.Context, coll *mongo.Collection) error
func MakeSymlinkQuery ¶
func MakeSymlinkSignature ¶
func NewMongoClient ¶
NewMongoClient creates a new mongo client using a connection uri. The caller is responsible for calling Disconnect:
client.Disconnect(ctx)
Types ¶
type FileDownloader ¶
func NewS3FileDownloader ¶
func NewS3FileDownloader(s3Sess *session.Session, bucket string) FileDownloader
type FileUploader ¶
func NewS3FileUploader ¶
func NewS3FileUploader(sess *session.Session, bucket string) FileUploader
type Metadata ¶
type Metadata struct { Id string `bson:"id"` FileName string `bson:"filename"` CreatedAt time.Time `bson:"createdAt"` }
func NewMetadata ¶
type MetadataClient ¶
type MetadataClient interface { Create(ctx context.Context, md *Metadata) error GetById(ctx context.Context, id string) (*Metadata, error) DeleteById(ctx context.Context, id string) error }
func NewMongoMetadataClient ¶
func NewMongoMetadataClient(c *mongo.Client) MetadataClient
type MockMetadataClient ¶
type MockMetadataClient struct { CreateFunc func(ctx context.Context, md *Metadata) error GetFileById func(ctx context.Context, id string) (*Metadata, error) }
MockMetadataClient is a mock of MetadataClient which can be used by tests.
func (*MockMetadataClient) Create ¶
func (m *MockMetadataClient) Create(ctx context.Context, md *Metadata) error
func (*MockMetadataClient) DeleteById ¶
func (m *MockMetadataClient) DeleteById(ctx context.Context, id string) error
Click to show internal directories.
Click to hide internal directories.