Sha256: 820cc1337f8f6a2fef7ea8571ee60e4b788ab6031f3fc420a6350653986efe40

Contents?: true

Size: 1007 Bytes

Versions: 4

Compression:

Stored size: 1007 Bytes

Contents

#!/usr/bin/env bash

set -u

instances=1
if [ ! -z ${INSTANCES+x} ]; then
  instances=$INSTANCES
fi

stream_name="testStream-$(uuidgen)"
if [ ! -z ${STREAM_NAME+x} ]; then
  stream_name=$STREAM_NAME
fi

echo
echo "Writing $instances Messages to Stream $stream_name"
echo "= = ="
echo

default_name=message_store

if [ -z ${DATABASE_USER+x} ]; then
  echo "(DATABASE_USER is not set)"
  user=$default_name
else
  user=$DATABASE_USER
fi
echo "Database user is: $user"

if [ -z ${DATABASE_NAME+x} ]; then
  echo "(DATABASE_NAME is not set)"
  database=$default_name
else
  database=$DATABASE_NAME
fi
echo "Database name is: $database"
echo


for (( i=1; i<=instances; i++ )); do
  uuid=$(echo $(uuidgen) | tr '[:upper:]' '[:lower:]')

  echo "Instance: $i, Message ID: $uuid"

  psql $database -U $user -c "SELECT write_message('$uuid'::varchar, '$stream_name'::varchar, 'SomeType'::varchar, '{\"attribute\": \"some value\"}'::jsonb, '{\"metaAttribute\": \"some meta value\"}'::jsonb);" > /dev/null
done

echo

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
evt-message_store-postgres-database-0.1.4.2 database/write-test-message.sh
evt-message_store-postgres-database-0.1.4.1 database/write-test-message.sh
evt-message_store-postgres-database-0.1.4.0 database/write-test-message.sh
evt-message_store-postgres-database-0.1.3.1 database/write-test-message.sh