repository

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSS3Repository

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

AWSS3Repository struct.

func NewAWSS3Repository

func NewAWSS3Repository(logger *logger.Logger, s *session.Session, config *aws.Config) *AWSS3Repository

NewAWSS3Repository returns AWSS3Repository instance.

func (*AWSS3Repository) CreateBucket

func (r *AWSS3Repository) CreateBucket(bucket string) (*s3.CreateBucketOutput, error)

CreateBucket creates a new S3 bucket. To create a bucket, you must register with Amazon S3 and have a valid AWS Access Key ID to authenticate requests. Anonymous requests are never allowed to create buckets. By creating the bucket, you become the bucket owner. https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html

func (*AWSS3Repository) DeleteBucket

func (r *AWSS3Repository) DeleteBucket(bucket string) (*s3.DeleteBucketOutput, error)

DeleteBucket deletes the S3 bucket. All objects (including all object versions and delete markers) in the bucket must be deleted before the bucket itself can be deleted. https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html

func (*AWSS3Repository) DeleteObject

func (r *AWSS3Repository) DeleteObject(bucket, key string) (*s3.DeleteObjectOutput, error)

DeleteObject removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects but will still respond that the command was successful. https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html

func (*AWSS3Repository) DeleteObjects

func (r *AWSS3Repository) DeleteObjects(bucket string, keys []string) (*s3.DeleteObjectsOutput, error)

DeleteObjects action enables you to delete multiple objects from a bucket using a single HTTP request. If you know the object keys that you want to delete, then this action provides a suitable alternative to sending individual delete requests, reducing per-request overhead. https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html

func (*AWSS3Repository) Download added in v0.0.18

func (r *AWSS3Repository) Download(bucket, key, filePath string) error

Download retrieves objects from Amazon S3.

func (*AWSS3Repository) GetObject

func (r *AWSS3Repository) GetObject(bucket, key string) (*s3.GetObjectOutput, error)

GetObject retrieves objects from Amazon S3. https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html

func (*AWSS3Repository) GetPresignedURL

func (r *AWSS3Repository) GetPresignedURL(bucket, key string, expire time.Duration) (string, error)

GetPresignedURL creates a Pre-Singed URL. https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/s3-example-presigned-urls.html

func (*AWSS3Repository) ListBuckets

func (r *AWSS3Repository) ListBuckets() (*s3.ListBucketsOutput, error)

ListBuckets returns a list of all buckets owned by the authenticated sender of the request. To use this operation, you must have the s3:ListAllMyBuckets permission. https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html

func (*AWSS3Repository) ListObjectsV2

func (r *AWSS3Repository) ListObjectsV2(bucket, prefix string) (*s3.ListObjectsV2Output, error)

ListObjectsV2 returns some or all (up to 1,000) of the objects in a bucket with each request. You can use the request parameters as selection criteria to return a subset of the objects in a bucket. A 200 OK response can contain valid or invalid XML. Make sure to design your application to parse the contents of the response and handle it appropriately. Objects are returned sorted in an ascending order of the respective key names in the list. For more information about listing objects, see Listing object keys programmatically https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html

func (*AWSS3Repository) PutObjectFile

func (r *AWSS3Repository) PutObjectFile(bucket, key, filePath string) (*s3.PutObjectOutput, error)

PutObjectFile adds an object to a bucket. https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html

func (*AWSS3Repository) PutObjectText

func (r *AWSS3Repository) PutObjectText(bucket, key string, text *string) (*s3.PutObjectOutput, error)

PutObjectText adds an object to a bucket. https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html

func (*AWSS3Repository) Upload added in v0.0.18

func (r *AWSS3Repository) Upload(bucket, key, filePath string) (*s3manager.UploadOutput, error)

Upload adds an object to a bucket.

type AWSS3RepositoryInterface

type AWSS3RepositoryInterface interface {
	GetObject(bucket, path string) io.ReaderAt
	PutObjectFile(bucket, key, filePath string) (*s3.PutObjectOutput, error)
	PutObjectText(bucket, key string, text *string) (*s3.PutObjectOutput, error)
	DeleteObject(bucket, key string) (*s3.DeleteObjectOutput, error)
	DeleteObjects(bucket string, keys []string) (*s3.DeleteObjectsOutput, error)
	ListObjectsV2(bucket, prefix string) (*s3.ListObjectsV2Output, error)
	ListBuckets() (*s3.ListBucketsOutput, error)
	CreateBucket(bucket string) (*s3.CreateBucketOutput, error)
	DeleteBucket(bucket string) (*s3.DeleteBucketOutput, error)
	GetPresignedURL(bucket, key string, expire time.Duration) (string, error)
	Upload(bucket, key, filePath string) (*s3manager.UploadOutput, error)
	Download(bucket, key, filePath string) error
}

AWSS3RepositoryInterface interface.

type AWSSESRepository

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

AWSSESRepository struct.

func NewAWSSESRepository

func NewAWSSESRepository(logger *logger.Logger, s *ses.SES, configurationSetName *string, isOutputLogPersonalInformation bool) *AWSSESRepository

NewAWSSESRepository returns AWSSESRepository instance.

func (*AWSSESRepository) SendEmail

func (r *AWSSESRepository) SendEmail(from, to, subject, contentText, contentHTML string) error

SendEmail sends email.

func (*AWSSESRepository) SendHTMLEmail

func (r *AWSSESRepository) SendHTMLEmail(from, to, subject, content string) error

SendHTMLEmail sends HTML email.

func (*AWSSESRepository) SendTextEmail

func (r *AWSSESRepository) SendTextEmail(from, to, subject, content string) error

SendTextEmail sends text email.

type AWSSESRepositoryInterface

type AWSSESRepositoryInterface interface {
	// Use via SendEmailService
	SendTextEmail(from, to, subject, content string) error
	SendHtmlEmail(from, to, subject, content string) error
	SendEmail(from, to, subject, content string) error
}

AWSSESRepositoryInterface interface.

type BaseRepository

type BaseRepository struct {
	Logger *logger.Logger
}

BaseRepository struct.

func NewBaseRepository

func NewBaseRepository(logger *logger.Logger) *BaseRepository

NewBaseRepository returns BaseRepository instance.

type RedisRepository added in v0.0.18

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

RedisRepository struct.

func NewRedisRepository added in v0.0.18

func NewRedisRepository(logger *logger.Logger, r *redis.Client) *RedisRepository

NewRedisRepository returns RedisRepository instance.

func (*RedisRepository) Append added in v0.0.18

func (r *RedisRepository) Append(c context.Context, key, value string) error

Append Redis `APPEND key value` command.

func (*RedisRepository) BitCount added in v0.0.18

func (r *RedisRepository) BitCount(c context.Context, key string, bitCount *redis.BitCount) (int64, error)

BitCount Redis `BITCOUNT key` command.

func (*RedisRepository) Decr added in v0.0.18

func (r *RedisRepository) Decr(c context.Context, key string) error

Decr Redis `DECR key` command.

func (*RedisRepository) DecrBy added in v0.0.18

func (r *RedisRepository) DecrBy(c context.Context, key string, value int64) error

DecrBy Redis `DECRBY key value` command.

func (*RedisRepository) Get added in v0.0.18

func (r *RedisRepository) Get(c context.Context, key string) (string, error)

Get Redis `GET key` command.

func (*RedisRepository) GetBit added in v0.0.18

func (r *RedisRepository) GetBit(c context.Context, key string, offset int64) (int64, error)

GetBit Redis `GETBIT key start end` command.

func (*RedisRepository) GetRange added in v0.0.18

func (r *RedisRepository) GetRange(c context.Context, key string, start, end int64) (string, error)

GetRange Redis `GETRANGE key start end` command.

func (*RedisRepository) GetSet added in v0.0.18

func (r *RedisRepository) GetSet(c context.Context, key string, value interface{}) (string, error)

GetSet Redis `GETSET key` command.

func (*RedisRepository) Incr added in v0.0.18

func (r *RedisRepository) Incr(c context.Context, key string) error

Incr Redis `INCR key` command.

func (*RedisRepository) IncrBy added in v0.0.18

func (r *RedisRepository) IncrBy(c context.Context, key string, value int64) error

IncrBy Redis `INCRBY key value` command.

func (*RedisRepository) IncrByfloat added in v0.0.18

func (r *RedisRepository) IncrByfloat(c context.Context, key string, value float64) error

IncrByfloat Redis `INCRBYFLOAT key value` command.

func (*RedisRepository) MGet added in v0.0.18

func (r *RedisRepository) MGet(c context.Context, keys ...string) ([]interface{}, error)

MGet Redis `MGET keys...` command.

func (*RedisRepository) MSet added in v0.0.18

func (r *RedisRepository) MSet(c context.Context, values ...interface{}) (string, error)

MSet Redis `MSET key value key2 value2...` command.

func (*RedisRepository) MSetNX added in v0.0.18

func (r *RedisRepository) MSetNX(c context.Context, values ...interface{}) (bool, error)

MSetNX Redis `MSETNX key value key2 value2...` command.

func (*RedisRepository) Set added in v0.0.18

func (r *RedisRepository) Set(c context.Context, key string, value interface{}, expiration time.Duration) error

Set Redis `SET key value [expiration]` command.

func (*RedisRepository) SetBit added in v0.0.18

func (r *RedisRepository) SetBit(c context.Context, key string, offset int64, value int) error

SetBit Redis `SETBIT key value offset value` command.

func (*RedisRepository) SetEX added in v0.0.18

func (r *RedisRepository) SetEX(c context.Context, key string, value interface{}, expiration time.Duration) error

SetEX Redis `SETEX key value expiration` command.

func (*RedisRepository) SetNX added in v0.0.18

func (r *RedisRepository) SetNX(c context.Context, key string, value interface{}, expiration time.Duration) error

SetNX Redis `SETNX key value [expiration]` command.

func (*RedisRepository) SetRange added in v0.0.18

func (r *RedisRepository) SetRange(c context.Context, key string, offset int64, value string) (int64, error)

SetRange Redis `SETRANGE key start end` command.

func (*RedisRepository) StrLen added in v0.0.18

func (r *RedisRepository) StrLen(c context.Context, key string) (int64, error)

StrLen Redis `STRLEN key` command.

type RedisRepositoryInterface added in v0.0.18

type RedisRepositoryInterface interface {
}

RedisRepositoryInterface interface.

type SlackRepository

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

SlackRepository struct.

func NewSlackRepository

func NewSlackRepository(logger *logger.Logger, client *slack.Client, channelID string) *SlackRepository

NewSlackRepository returns SlackRepository instance.

func (*SlackRepository) PostMessage

func (r *SlackRepository) PostMessage(text string) error

PostMessage sends a message to a channel. Message is escaped by default according to https://api.slack.com/docs/formatting Use http://davestevens.github.io/slack-message-builder/ to help crafting your message.

func (*SlackRepository) PostMessageAttachment

func (r *SlackRepository) PostMessageAttachment(attachment *slack.Attachment) error

PostMessageAttachment sends a message to a channel. Message is escaped by default according to https://api.slack.com/docs/formatting Use http://davestevens.github.io/slack-message-builder/ to help crafting your message.

type SlackRepositoryInterface

type SlackRepositoryInterface interface {
	PostMessage(attachment *slack.Attachment) error
	PostMessageAttachment(attachment *slack.Attachment) error
}

SlackRepositoryInterface interface

Directories

Path Synopsis
Package mock_repository is a generated GoMock package.
Package mock_repository is a generated GoMock package.

Jump to

Keyboard shortcuts

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