Documentation ¶
Overview ¶
Package rdsql implements some methods to access an RDS Aurora Servless DB cluster via RDS DataService
See https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html
Index ¶
- Variables
- func ContextWithSignal(timeout time.Duration, terminate chan os.Signal) (ctx context.Context, cancel context.CancelFunc)
- func GetAWSConfig(profile string, debug bool) aws.Config
- func SQLReader(db *Client, query string) chan string
- func SQLReaderLoop(db *Client, query, first string) chan string
- func StringOrNil(s string) *string
- type Client
- func (c *Client) BeginTransaction(terminate chan os.Signal) (string, error)
- func (c *Client) CommitTransaction(tid string, terminate chan os.Signal) (string, error)
- func (c *Client) CommitTransactionContext(ctx context.Context, tid string) (string, error)
- func (c *Client) EndTransaction(tid string, commit bool, terminate chan os.Signal) (string, error)
- func (c *Client) EndTransactionContext(ctx context.Context, tid string, commit bool) (string, error)
- func (c *Client) ExecuteStatement(stmt string, params []Parameter, transactionId string, ...) (Results, error)
- func (c *Client) ExecuteStatementContext(ctx context.Context, stmt string, params []Parameter, transactionId string) (Results, error)
- func (c *Client) Ping(terminate chan os.Signal) (err error)
- func (c *Client) PingContext(ctx context.Context) (err error)
- func (c *Client) RollbackTransaction(tid string, terminate chan os.Signal) (string, error)
- func (c *Client) RollbackTransactionContext(ctx context.Context, tid string) (string, error)
- type ColumnMetadata
- type Field
- type FieldMemberBooleanValue
- type FieldMemberIsNull
- type FieldMemberLongValue
- type FieldMemberStringValue
- type Parameter
- type Results
Constants ¶
This section is empty.
Variables ¶
var PingRetries = 5
var PingRetryPrefix = "PING RETRY"
var QueryRetries = 5
var SQLReaderBuffer = 10
var Verbose = true
Functions ¶
func ContextWithSignal ¶
func GetAWSConfig ¶
GetAWSConfig return an aws.Config profile
func SQLReaderLoop ¶
SQLReaderLoop returns a "list" of results from the specified queury. It will execute the query in a loop until there are no more results. It is possible to start a query from where the previous left off by adding a placeholder like {field} (i.e. select a,b,c from table where a > {a} limit 10). In this case {a} will be replaced with the last value of `a` from the previous call. Pass the appropriate value for `first` to initialize {field} (i.e. "" or 0)
func StringOrNil ¶
StringOrNil return nil for an empty string or aws.String
Types ¶
type Client ¶
type Client struct { ResourceArn string SecretArn string Database string Timeout time.Duration Continue bool // ContinueAfterTimeout // contains filtered or unexported fields }
Client wraps *rdsdata.Client and client configuration (ResourceArn, SecretArn, etc...)
func ClientWithOptions ¶
ClientWithOptions creates an instance of Client given a list of options
func ClientWithURI ¶
ClientWithURI creates an instance of Client given an rdsql URI
Format: rdsql:{profile};{resource};{secret};{database}
func (*Client) BeginTransaction ¶
BeginTransaction executes rdsdata BeginTransaction
func (*Client) CommitTransaction ¶
CommitTransaction executes rdsdata CommitTransaction
func (*Client) CommitTransactionContext ¶
CommitTransaction executes rdsdata CommitTransaction
func (*Client) EndTransaction ¶
EndTransaction executes either a commit or a rollback request
func (*Client) EndTransactionContext ¶
func (c *Client) EndTransactionContext(ctx context.Context, tid string, commit bool) (string, error)
EndTransaction executes either a commit or a rollback request
func (*Client) ExecuteStatement ¶
func (c *Client) ExecuteStatement(stmt string, params []Parameter, transactionId string, terminate chan os.Signal) (Results, error)
ExecuteStatement executes a SQL statement and return Results
parameters could be passed as :par1, :par2... in the SQL statement with associated parameter mapping in the request
func (*Client) ExecuteStatementContext ¶
func (*Client) RollbackTransaction ¶
RollbackTransaction executes rdsdata RollbackTransaction
type ColumnMetadata ¶
type ColumnMetadata = types.ColumnMetadata
ColumnMetadata is an alias for rdsdata types.ColumnMetadata
type FieldMemberBooleanValue ¶
type FieldMemberBooleanValue = types.FieldMemberBooleanValue
type FieldMemberIsNull ¶
type FieldMemberIsNull = types.FieldMemberIsNull
type FieldMemberLongValue ¶
type FieldMemberLongValue = types.FieldMemberLongValue
type FieldMemberStringValue ¶
type FieldMemberStringValue = types.FieldMemberStringValue
type Results ¶
type Results = *rdsdata.ExecuteStatementOutput
Results is an alias for *rdsdata.ExecuteStatementOutput