cmd

package
v0.0.0-...-42cee99 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAttDecode = errors.New("document attachment can not be decoded")
View Source
var ErrAttPreSign = errors.New("preSigned url cannot be created")
View Source
var ErrAttUpload = errors.New("document attachment cannot be saved in storage")
View Source
var ErrDocCreate = errors.New("technical issue while the document was created")
View Source
var ErrDocLoader = errors.New("document cannot be retrieved from the database")
View Source
var ErrDocMarshal = errors.New("document can not be marshaled")
View Source
var ErrDocNotFound = errors.New("document cannot be found in the database")
View Source
var ErrDocSave = errors.New("document cannot be saved in the database")
View Source
var ErrDocUnMarshal = errors.New("document can not be marshaled")

Functions

func GenDocItemOutput

func GenDocItemOutput(doc entity.Document) *dynamodb.GetItemOutput

Types

type AttachCommand

type AttachCommand struct {
	// contains filtered or unexported fields
}

func NewAttachCommand

func NewAttachCommand(s3s S3Putter, s3p S3PreSigner, ddb DynamoDBGetter, log *zap.SugaredLogger) AttachCommand

func (AttachCommand) Execute

func (a AttachCommand) Execute(ctx context.Context, attachment domain.Attachment) (domain.PreSignedUrl, error)

type CreateCommand

type CreateCommand struct {
	// contains filtered or unexported fields
}

func NewCreateCommand

func NewCreateCommand(ddb DynamoDBAPI, log *zap.SugaredLogger) CreateCommand

func (CreateCommand) Execute

func (c CreateCommand) Execute(ctx context.Context, doc domain.Document) error

type DynamoDBAPI

type DynamoDBAPI interface {
	DynamoDBPutter
}

type DynamoDBGetter

type DynamoDBGetter interface {
	GetItem(ctx context.Context,
		params *dynamodb.GetItemInput,
		optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
}

type DynamoDBPutter

type DynamoDBPutter interface {
	PutItem(ctx context.Context,
		params *dynamodb.PutItemInput,
		optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
}

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(ddb DynamoDBGetter, log *zap.SugaredLogger) Loader

func (Loader) Load

func (l Loader) Load(ctx context.Context, docId string) (domain.Document, error)

type MockDynamo

type MockDynamo struct {
	GetItemOut *dynamodb.GetItemOutput
	GetItemIn  *dynamodb.GetItemInput
	ErrGetItem error

	PutItemOut *dynamodb.PutItemOutput
	PutItemIn  *dynamodb.PutItemInput
	ErrPutItem error
}

func (*MockDynamo) GetItem

func (m *MockDynamo) GetItem(ctx context.Context, params *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)

func (*MockDynamo) PutItem

func (m *MockDynamo) PutItem(ctx context.Context, params *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)

type MockS3

type MockS3 struct {
	PutObjOut *s3.PutObjectOutput
	PutObjIn  *s3.PutObjectInput
	ErrPutObj error
}

func (*MockS3) PutObject

func (m *MockS3) PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)

type MockS3PreSign

type MockS3PreSign struct {
	PutObjOut *v4.PresignedHTTPRequest
	ErrGetObj error
}

func (*MockS3PreSign) PresignGetObject

func (m *MockS3PreSign) PresignGetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(options *s3.PresignOptions)) (*v4.PresignedHTTPRequest, error)

type PreSigner

type PreSigner struct {
	// contains filtered or unexported fields
}

func NewPreSigner

func NewPreSigner(s3s S3PreSigner, log *zap.SugaredLogger) PreSigner

func (PreSigner) PreSign

func (p PreSigner) PreSign(ctx context.Context, attachment domain.Attachment) (domain.PreSignedUrl, error)

type S3PreSigner

type S3PreSigner interface {
	PresignGetObject(ctx context.Context,
		params *s3.GetObjectInput,
		optFns ...func(options *s3.PresignOptions)) (*v4.PresignedHTTPRequest, error)
}

type S3Putter

type S3Putter interface {
	PutObject(ctx context.Context,
		params *s3.PutObjectInput,
		optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
}

type Saver

type Saver struct {
	// contains filtered or unexported fields
}

func NewSaver

func NewSaver(ddb DynamoDBPutter, log *zap.SugaredLogger) *Saver

func (*Saver) Save

func (s *Saver) Save(ctx context.Context, doc domain.Document) error

type Uploader

type Uploader struct {
	// contains filtered or unexported fields
}

func NewUploader

func NewUploader(s3s S3Putter, log *zap.SugaredLogger) Uploader

func (Uploader) Upload

func (u Uploader) Upload(ctx context.Context, attachment domain.Attachment) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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