Documentation ¶
Overview ¶
Package database is part of the Tarmac suite of Host Callback packages. This package provides users with the ability to provide WASM functions with a host callback interface that provides SQL database capabilities.
import ( "github.com/madflojo/tarmac/pkg/callbacks" "github.com/madflojo/tarmac/pkg/callbacks/sql" ) func main() { // Create instance of database to register for callback execution dBase := database.New(sql.Config{}) // Create Callback router and register router := callbacks.New() router.RegisterCallback("sql", "query", dBase.Query) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // DB is the user-provided SQL database instance using the standard "database/sql" interface. This package by // itself does not manage database connections but rather relies on the sql.DB interface. Users must // supply an initiated sql.DB to work with. DB *sql.DB }
Config is provided to users to configure the Host Callback. All Tarmac Callbacks follow the same configuration format; each Config struct gives the specific Host Callback unique functionality.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database provides access to Host Callbacks that interface with a SQL database within Tarmac. The callbacks within Database provide all the logic and error hangling of accessing and interacting with a SQL database. Users will send the specified JSON request to execute a query and receive an appropriate JSON response.
func New ¶
New will create and return a new Database instance that users can register as a Tarmac Host Callback function. Users can provide any custom Database configurations using the configuration options supplied.