database

package
v0.0.0-...-c86e3d9 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DbConn *sql.DB
)

DbConn stores the connexion to the database

Functions

func Connect

func Connect() error

Connect connection to database

Types

type Article

type Article struct {
	ID          string `json:"aggregate_article_id"`
	Title       string `json:"title"`
	Description string `json:"description"`
}

Article data model on elasticsearch database (index called read-model)

type Config

type Config struct {
	DbHost     string `env:"DB_HOST"`
	DbName     string `env:"MYSQL_DATABASE"`
	DbUser     string `env:"MYSQL_USER"`
	DbPassword string `env:"MYSQL_PASSWORD"`
	DbConn     *sql.DB
}

Config for DB connection

type Event

type Event struct {
	ID        string  `json:"event_id"`
	EventType string  `json:"event_type"`
	CreatedAt string  `json:"created_at"`
	Payload   Article `json:"payload"`
}

Event data model on elasticsearch database (index called event-store)

type RequestCreateEvent

type RequestCreateEvent struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	EventType   string `json:"event_type"`
}

RequestCreateEvent request to create an event on elasticsearch database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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