Documentation ¶
Overview ¶
Package postgres is responsible for postgres database connections and initialization.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PostgresQueries = []string{
`CREATE TABLE IF NOT EXISTS Thread(
Id uuid PRIMARY KEY,
CreatedAt TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(6) not null,
Path varchar(255) not null UNIQUE
)`,
`CREATE TABLE IF NOT EXISTS Comment(
Id uuid PRIMARY KEY,
ThreadId uuid not null,
Body text not null,
Author varchar(255) not null,
Confirmed bool not null default false,
CreatedAt TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(6) not null,
ReplyTo uuid default null,
DeletedAt TIMESTAMP(6) NULL,
FOREIGN KEY(ThreadId) references Thread(Id)
)`,
}
PostgresQueries represents a list of queries for initial table creation in Postgres
Functions ¶
func CreateDatabase ¶
func CreateDatabase(databaseConfig model.Database) (abstraction.Database, error)
CreateDatabase creates a database instance from the given config
func CreateTestDatabase ¶
func CreateTestDatabase() abstraction.Database
CreateTestDatabase creates a test database
func ValidateConfig ¶
ValidateConfig validates the config for mysql
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.