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