Go - SqlDatabase.ConnectionString()

Returns the connection string for a SQL database at runtime.

import (
"context"
"github.com/nitrictech/go-sdk/nitric"
)
func main() {
db := nitric.NewSqlDatabase("my-database")
// Should be called at runtime, such as in a service handler
connStr, _ := db.ConnectionString(context.TODO())
nitric.Run()
}

Examples

Return a connection string

import (
"context"
"github.com/nitrictech/go-sdk/nitric"
)
func main() {
db := nitric.NewSqlDatabase("my-database")
// Should be called at runtime, such as in a service handler
connStr, _ := db.ConnectionString(context.TODO())
nitric.Run()
}
Last updated on Nov 28, 2024