AWS SDK for Go (PILOT)
API Reference

PREVIEW DOCUMENTATION - This is a preview of a new format for the AWS SDK for Go API Reference documentation. For the current AWS SDK for Go API Reference, see https://docs.aws.amazon.com/sdk-for-go/api/.

We welcome your feedback on this new version of the documentation. Send your comments to aws-sdkdocs-feedback@amazon.com.

ConnectionStringBuilder

import "github.com/aws/aws-sdk-go/service/rds/rdsutils"

type ConnectionStringBuilder struct { }

ConnectionStringBuilder is a builder that will construct a connection string with the provided parameters. params field is required to have a tls specification and allowCleartextPasswords must be set to true.

Method

Build

func (b ConnectionStringBuilder) Build() (string, error)

Build will return a new connection string that can be used to open a connection to the desired database.

Example: b := rdsutils.NewConnectionStringBuilder(endpoint, region, user, dbname, creds) connectStr, err := b.WithTCPFormat().Build() if err != nil { panic(err) } const dbType = "mysql" db, err := sql.Open(dbType, connectStr)

WithDBName

func (b ConnectionStringBuilder) WithDBName(dbName string) ConnectionStringBuilder

WithDBName will return a builder with the given database name

WithEndpoint

func (b ConnectionStringBuilder) WithEndpoint(endpoint string) ConnectionStringBuilder

WithEndpoint will return a builder with the given endpoint

WithFormat

func (b ConnectionStringBuilder) WithFormat(f ConnectionFormat) ConnectionStringBuilder

WithFormat will return a builder with the given connection format

WithParams

func (b ConnectionStringBuilder) WithParams(params url.Values) ConnectionStringBuilder

WithParams will return a builder with the given params. The parameters will be included in the connection query string

Example: v := url.Values{} v.Add("tls", "rds") b := rdsutils.NewConnectionBuilder(endpoint, region, user, dbname, creds) connectStr, err := b.WithParams(v).WithTCPFormat().Build()

WithRegion

func (b ConnectionStringBuilder) WithRegion(region string) ConnectionStringBuilder

WithRegion will return a builder with the given region

WithTCPFormat

func (b ConnectionStringBuilder) WithTCPFormat() ConnectionStringBuilder

WithTCPFormat will set the format to TCP and return the modified builder

WithUser

func (b ConnectionStringBuilder) WithUser(user string) ConnectionStringBuilder

WithUser will return a builder with the given user

On this page: