mirror of
https://github.com/jlelse/GoBlog
synced 2024-07-03 01:47:34 +00:00
39 lines
999 B
Go
39 lines
999 B
Go
package plugintypes
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
)
|
|
|
|
// App is used to access GoBlog's app instance.
|
|
type App interface {
|
|
// Get access to GoBlog's database
|
|
GetDatabase() Database
|
|
// Get a post from the database or an error when there is no post for the given path
|
|
GetPost(path string) (Post, error)
|
|
}
|
|
|
|
// Database is used to provide access to GoBlog's database.
|
|
type Database interface {
|
|
Exec(string, ...any) (sql.Result, error)
|
|
ExecContext(context.Context, string, ...any) (sql.Result, error)
|
|
Query(string, ...any) (*sql.Rows, error)
|
|
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
|
|
QueryRow(string, ...any) (*sql.Row, error)
|
|
QueryRowContext(context.Context, string, ...any) (*sql.Row, error)
|
|
}
|
|
|
|
// Post
|
|
type Post interface {
|
|
// Get a string array map with all the post's parameters
|
|
GetParameters() map[string][]string
|
|
}
|
|
|
|
// RenderContext
|
|
type RenderContext interface {
|
|
// Get the path of the request
|
|
GetPath() string
|
|
// Get the blog name
|
|
GetBlog() string
|
|
}
|