Documentation
¶
Overview ¶
Package rds is the trumpet line of this operation -- blasts your SQL queries through the AWS RDS Data API and brings the results back home. Handles the connection, executes the statements, and stamps each query with a ska legend so you can track your pressings through the collection.
Index ¶
Constants ¶
const MaxQuerySize = 65536
Variables ¶
var ( ErrQueryTooLong = fmt.Errorf("query size exceeds %d bytes", MaxQuerySize) ErrQueryIsEmpty = errors.New("query can't be empty") )
Functions ¶
func NewIDGenerator ¶
func NewIDGenerator() *idGen
NewIDGenerator sets up a fresh generator seeded with the current time. Ready to rock from the moment you plug it in.
func NewIDGeneratorWithSeed ¶
func NewIDGeneratorWithSeed(seed uint64) *idGen
NewIDGeneratorWithSeed is the soundcheck version -- lets you tune the RNG to a specific frequency, when you need your setlist to be reproducible, not random like a real punk show.
func ValidateClusterARN ¶
ValidateClusterARN checks if your cluster ARN is legit -- empty gets a pass, but a bogus venue means the gig's off before it starts.
func ValidateSecretARN ¶
ValidateSecretARN checks if your secret ARN passes muster -- empty is fine, but fake creds will get you slapped hard.
Types ¶
type Client ¶
type Client struct {
ClientConfig
// contains filtered or unexported fields
}
Client spins the decks -- your connection to the RDS Data API.
func NewClient ¶
func NewClient(ctx context.Context, rider *ClientConfig) (*Client, error)
NewClient fires up the soundsystem -- one thing that you can depend on. Validates your rider, plugs into AWS, and gets the decks ready to spin.
func (*Client) ExecuteQuery ¶
ExecuteQuery drops the needle and lets it rip.
func (*Client) ExecuteSQL ¶
ExecuteSQL is the one-shot single -- cue and play in one motion.
type ClientConfig ¶
ConnectionInfo is your rider for the gig.
- ClusterARN is the venue
- SecretARN gets you through the door
- Database is which stage you're playing
func (*ClientConfig) Validate ¶
func (c *ClientConfig) Validate() error
Validate checks if you've got venue, credentials, and stage sorted -- can't start the show without all three.
type Query ¶
type Query struct {
CreatedAt time.Time
Label string
SQL string
Result *QueryResult
}
Query is a tune waiting to be played -- SQL on deck, result on standby.
type QueryResult ¶
QueryResult is what comes back from the pit.
- SELECT fills the `Columns` and `Rows`
- INSERT/UPDATE/DELETE counts the damage in `NumberOfRowsUpdated`
func BuildQueryResult ¶
func BuildQueryResult(output *rdsdata.ExecuteStatementOutput) *QueryResult
BuildQueryResult masters the raw take from the soundboard -- pulls the setlist from metadata and presses the tracks into something you can spin.
func (*QueryResult) Message ¶
func (qr *QueryResult) Message() string
Message calls out what went down -- rows returned, rows wrecked, or just a nod that the set played clean.