Refactor extensions
parent
aa27ad084c
commit
df818c0a17
@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
// AppConfig defines the database configuration. All other configuration
|
||||
// options are stored within the database.
|
||||
type AppConfig struct {
|
||||
// Driver specifies the database driver to use. By default, the "sqlite"
|
||||
// and "pq" (PostgreSQL) drivers are available. Sriracha may be compiled
|
||||
// with support for any other database driver by adding it to the imports.
|
||||
Driver string
|
||||
|
||||
// DataSource defines the where and how to interface with the database. Its
|
||||
// contents depend on which database driver is in use.
|
||||
//
|
||||
// When using the "sqlite" driver, Datasource may be set to a file path,
|
||||
// typically ending in ".db".
|
||||
//
|
||||
// See https://pkg.go.dev/modernc.org/sqlite#Driver.Open for a full list of options.
|
||||
//
|
||||
// When using the "pq" driver, DataSource may be set as follows:
|
||||
//
|
||||
// postgres://username:password@localhost:5432/database?sslmode=disable
|
||||
//
|
||||
// See https://pkg.go.dev/github.com/lib/pq for a full list of options.
|
||||
DataSource string
|
||||
}
|
||||
|
||||
var config = &AppConfig{}
|
@ -1,11 +1,11 @@
|
||||
package sriracha
|
||||
|
||||
// ExtensionPost defines the interface for extensions that handle creating a post.
|
||||
type ExtensionPost interface {
|
||||
Extension
|
||||
|
||||
InsertPost(post *Post) error
|
||||
|
||||
DeletePost(post *Post) error
|
||||
|
||||
RenderPost(post *Post) ([]byte, error)
|
||||
// Post is called when a new post is created. Extensions may modify the
|
||||
// post and apply formatting or other operations on it. All text is
|
||||
// initially HTML-escaped.
|
||||
Post(post *Post) error
|
||||
}
|
||||
|
Loading…
Reference in New Issue