Documentation ¶
Overview ¶
Package sqlxDriver allows for data manipulation through the github.com/jmoiron/sqlx package.
Index ¶
- type Database
- func (db *Database) CleanUpStaleData(target global.CleanupType, timeout int64) error
- func (db *Database) CleanupDeleted(olderThan time.Time) error
- func (db *Database) CleanupUnconfirmed(olderThan time.Time) error
- func (db *Database) CreateComment(body string, author string, path string, confirmed bool, replyTo *uuid.UUID) (*uuid.UUID, error)
- func (db *Database) CreateThread(path string) (*uuid.UUID, error)
- func (db *Database) DeleteComment(id uuid.UUID) error
- func (db *Database) GetAllComments() (comments []model.Comment, err error)
- func (db *Database) GetAllThreads() (threads []model.Thread, err error)
- func (db *Database) GetComment(id uuid.UUID) (comment model.Comment, err error)
- func (db *Database) GetCommentsByThread(path string) (comments []model.Comment, err error)
- func (db *Database) GetDatabaseDialect() string
- func (db *Database) GetThread(path string) (thread model.Thread, err error)
- func (db *Database) GetUnderlyingStruct() interface{}
- func (db *Database) HardDeleteComment(commentId uuid.UUID) error
- func (db *Database) ImportData(pathToDump string) error
- func (db *Database) InitializeDatabase() error
- func (db *Database) RestoreDeletedComment(id uuid.UUID) error
- func (db *Database) UpdateComment(id uuid.UUID, body, author string, confirmed bool) error
- func (db *Database) WipeOutData() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
Database is a database instance for sqlx
func (*Database) CleanUpStaleData ¶
func (db *Database) CleanUpStaleData(target global.CleanupType, timeout int64) error
CleanUpStaleData removes the stale data from the database
func (*Database) CleanupDeleted ¶
CleanupDeleted removes the deleted comments that are older than the given time
func (*Database) CleanupUnconfirmed ¶
CleanupUnconfirmed removes the unconfirmed comments that are older than the given time
func (*Database) CreateComment ¶
func (db *Database) CreateComment(body string, author string, path string, confirmed bool, replyTo *uuid.UUID) (*uuid.UUID, error)
CreateComment takes in a body, author, and path and creates a comment for the given thread. If thread does not exist, it creates one
func (*Database) CreateThread ¶
CreateThread takes the thread path and creates it in the database
func (*Database) DeleteComment ¶
DeleteComment soft-deletes the comment by id and all the replies to it
func (*Database) GetAllComments ¶
GetAllComments gets all the comments found in the database
func (*Database) GetAllThreads ¶
GetAllThreads gets all the threads found in the database
func (*Database) GetComment ¶
GetComment gets comment by id
func (*Database) GetCommentsByThread ¶
GetCommentsByThread gets all the comments by thread path
func (*Database) GetDatabaseDialect ¶
GetDatabaseDialect returns the current database dialect
func (*Database) GetUnderlyingStruct ¶
func (db *Database) GetUnderlyingStruct() interface{}
GetUnderlyingStruct returns the underlying database struct for the driver
func (*Database) HardDeleteComment ¶
HardDeleteComment permanently deletes the comment from a database.
func (*Database) ImportData ¶
ImportData performs the data import for the given driver
func (*Database) InitializeDatabase ¶
InitializeDatabase runs the queries for an initial database seed
func (*Database) RestoreDeletedComment ¶
RestoreDeletedComment restores the soft-deleted comment
func (*Database) UpdateComment ¶
UpdateComment updatesComment comment by id
func (*Database) WipeOutData ¶
WipeOutData deletes all the threads and comments in the database if the database is a test one
Directories ¶
Path | Synopsis |
---|---|
Package mysql is responsible for mysql database connections and initialization.
|
Package mysql is responsible for mysql database connections and initialization. |
Package postgres is responsible for postgres database connections and initialization.
|
Package postgres is responsible for postgres database connections and initialization. |
Package sqlite is responsible for sqlite database connections and initialization.
|
Package sqlite is responsible for sqlite database connections and initialization. |