Documentation ¶
Index ¶
- Constants
- type DialOption
- type Dialer
- type Option
- func WithAdminAPIEndpoint(url string) Option
- func WithCredentialsFile(filename string) Option
- func WithCredentialsJSON(b []byte) Option
- func WithDefaultDialOptions(opts ...DialOption) Option
- func WithDialFunc(dial func(ctx context.Context, network, addr string) (net.Conn, error)) Option
- func WithHTTPClient(client *http.Client) Option
- func WithOptions(opts ...Option) Option
- func WithRSAKey(k *rsa.PrivateKey) Option
- func WithRefreshTimeout(t time.Duration) Option
- func WithTokenSource(s oauth2.TokenSource) Option
- func WithUserAgent(ua string) Option
Constants ¶
const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DialOption ¶
type DialOption func(d *dialCfg)
A DialOption is an option for configuring how a Dialer's Dial call is executed.
func DialOptions ¶
func DialOptions(opts ...DialOption) DialOption
DialOptions turns a list of DialOption instances into an DialOption.
func WithTCPKeepAlive ¶
func WithTCPKeepAlive(d time.Duration) DialOption
WithTCPKeepAlive returns a DialOption that specifies the tcp keep alive period for the connection returned by Dial.
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
A Dialer is used to create connections to AlloyDB instance.
Use NewDialer to initialize a Dialer.
func NewDialer ¶
NewDialer creates a new Dialer.
Initial calls to NewDialer make take longer than normal because generation of an RSA keypair is performed. Calls with a WithRSAKeyPair DialOption or after a default RSA keypair is generated will be faster.
func (*Dialer) Close ¶
Close closes the Dialer; it prevents the Dialer from refreshing the information needed to connect. Additional dial operations may succeed until the information expires.
func (*Dialer) Dial ¶
func (d *Dialer) Dial(ctx context.Context, instance string, opts ...DialOption) (conn net.Conn, err error)
Dial returns a net.Conn connected to the specified AlloyDB instance. The instance argument must be the instance's URI, which is in the format projects/<PROJECT>/locations/<REGION>/clusters/<CLUSTER>/instances/<INSTANCE>
type Option ¶
type Option func(d *dialerConfig)
An Option is an option for configuring a Dialer.
func WithAdminAPIEndpoint ¶
WithAdminAPIEndpoint configures the underlying AlloyDB Admin API client to use the provided URL.
func WithCredentialsFile ¶
WithCredentialsFile returns an Option that specifies a service account or refresh token JSON credentials file to be used as the basis for authentication.
func WithCredentialsJSON ¶
WithCredentialsJSON returns an Option that specifies a service account or refresh token JSON credentials to be used as the basis for authentication.
func WithDefaultDialOptions ¶
func WithDefaultDialOptions(opts ...DialOption) Option
WithDefaultDialOptions returns an Option that specifies the default DialOptions used.
func WithDialFunc ¶
WithDialFunc configures the function used to connect to the address on the named network. This option is generally unnecessary except for advanced use-cases.
func WithHTTPClient ¶
WithHTTPClient configures the underlying AlloyDB Admin API client with the provided HTTP client. This option is generally unnecessary except for advanced use-cases.
func WithOptions ¶
WithOptions turns a list of Option's into a single Option.
func WithRSAKey ¶
func WithRSAKey(k *rsa.PrivateKey) Option
WithRSAKey returns an Option that specifies a rsa.PrivateKey used to represent the client.
func WithRefreshTimeout ¶
WithRefreshTimeout returns an Option that sets a timeout on refresh operations. Defaults to 30s.
func WithTokenSource ¶
func WithTokenSource(s oauth2.TokenSource) Option
WithTokenSource returns an Option that specifies an OAuth2 token source to be used as the basis for authentication.
func WithUserAgent ¶
WithUserAgent returns an Option that sets the User-Agent.
Directories ¶
Path | Synopsis |
---|---|
driver
|
|
pgxv4
Package pgxv4 provides an AlloyDB driver that uses pgx v4 and works with the database/sql package.
|
Package pgxv4 provides an AlloyDB driver that uses pgx v4 and works with the database/sql package. |
Package errtype provides a number of concrete types which are used by the alloydbconn package.
|
Package errtype provides a number of concrete types which are used by the alloydbconn package. |
internal
|
|