utils

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNumberAttribute added in v1.0.11

func AddNumberAttribute(item map[string]*dynamodb.AttributeValue, key string, value int64)

AddNumberAttribute adds number attribute to dynamodb input map

func AddStringAttribute added in v1.0.11

func AddStringAttribute(item map[string]*dynamodb.AttributeValue, key string, value string)

AddStringAttribute adds string attribute to dynamodb input map

func CreateEventWrapper

func CreateEventWrapper(eventType string) *event.Event

CreateEventWrapper creates a new event with the specified event type

func CurrentTime added in v1.0.11

func CurrentTime() (time.Time, string)

CurrentTime returns the current UTC time and current Time in the RFC3339 format

func DeleteFromS3 added in v1.0.11

func DeleteFromS3(filename string) error

DeleteFromS3 deletes file from s3

func DownloadFromS3 added in v1.0.11

func DownloadFromS3(filename string) ([]byte, error)

DownloadFromS3 downloads file from s3

func FmtDuration

func FmtDuration(d time.Duration) string

FmtDuration is a helper function to format a duration in the HH:MM:SS.sss format

func Int64Value added in v1.0.13

func Int64Value(input *int64) int64

Int64Value function convert int64 pointer to string

func ParseDateTime added in v1.0.13

func ParseDateTime(dateTimeStr string) (time.Time, error)

ParseDateTime attempts to convert the string to one of our supported date time formats

func SendEmail added in v1.0.8

func SendEmail(subject string, body string, recipients []string) error

SendEmail function send email. It uses emailSender interface.

func SetAuthUserProperties added in v1.0.13

func SetAuthUserProperties(authUser *auth.User, xUserName *string, xEmail *string)

SetAuthUserProperties adds username and email to auth user

func SetEmailSender added in v1.0.8

func SetEmailSender(es EmailSender)

SetEmailSender sets up default email sender

func SetS3Storage added in v1.0.11

func SetS3Storage(awsSession *session.Session, bucketName string)

SetS3Storage set default S3Storage

func SetSnsEmailSender added in v1.0.8

func SetSnsEmailSender(awsSession *session.Session, snsEventTopicARN string, senderEmailAddress string)

SetSnsEmailSender set sns as mechanism to send email

func StringValue added in v1.0.13

func StringValue(input *string) string

StringValue function convert string pointer to string

func TimeToString added in v1.0.11

func TimeToString(t time.Time) string

TimeToString returns time in the RFC3339 format

func ToEmailEvent

func ToEmailEvent(sender *string, recipients []string, subject *string, emailBody *string) *emailevent.EmailEvent

ToEmailEvent converts an organization model into a create org event model

func UploadToS3 added in v1.0.11

func UploadToS3(body []byte, projectID string, claType string, identifier string, signatureID string) error

UploadToS3 uploads file to s3 storage at path contract-group/<project-ID>/<claType>/<identifier>/<signatureID>.pdf claType should be cla or ccla identifier can be user-id or company-id

Types

type EmailSender added in v1.0.8

type EmailSender interface {
	SendEmail(subject string, body string, recipients []string) error
}

EmailSender contains method to send email

type S3Client added in v1.0.11

type S3Client struct {
	BucketName string
	// contains filtered or unexported fields
}

S3Client struct provide methods to interact with s3

func (*S3Client) Delete added in v1.0.11

func (s3c *S3Client) Delete(filename string) error

Delete file from s3

func (*S3Client) Download added in v1.0.11

func (s3c *S3Client) Download(filename string) ([]byte, error)

Download file from s3

func (*S3Client) Upload added in v1.0.11

func (s3c *S3Client) Upload(fileContent []byte, projectID string, claType string, identifier string, signatureID string) error

Upload file to s3 storage at path contract-group/<project-ID>/<claType>/<identifier>/<signatureID>.pdf claType should be cla or ccla identifier can be user-id or company-id

type S3Storage added in v1.0.11

type S3Storage interface {
	Upload(fileContent []byte, projectID string, claType string, identifier string, signatureID string) error
	Download(filename string) ([]byte, error)
	Delete(filename string) error
}

S3Storage provides methods to handle s3 storage

type Service added in v1.0.8

type Service interface {
}

Service interface defines methods of event service

func NewService added in v1.0.8

func NewService() Service

NewService creates new instance of event service

Jump to

Keyboard shortcuts

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